mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-08 22:18:28 +03:00
*.jsx -> *.js
This commit is contained in:
parent
0a2b826f71
commit
e88c193334
98 changed files with 341 additions and 340 deletions
29
dev/Storage/Client.js
Normal file
29
dev/Storage/Client.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
import _ from '_';
|
||||
import {CookieDriver} from 'Common/ClientStorageDriver/Cookie';
|
||||
import {LocalStorageDriver} from 'Common/ClientStorageDriver/LocalStorage';
|
||||
|
||||
const SupportedStorageDriver = _.find(
|
||||
[LocalStorageDriver, CookieDriver], (StorageDriver) => StorageDriver && StorageDriver.supported()
|
||||
);
|
||||
|
||||
const driver = SupportedStorageDriver ? new SupportedStorageDriver() : null;
|
||||
|
||||
/**
|
||||
* @param {number} key
|
||||
* @param {*} data
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function set(key, data)
|
||||
{
|
||||
return driver ? driver.set('p' + key, data) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} key
|
||||
* @returns {*}
|
||||
*/
|
||||
export function get(key)
|
||||
{
|
||||
return driver ? driver.get('p' + key) : null;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue