mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
Sound notification
Additional code refactoring
This commit is contained in:
parent
b42ce01e7e
commit
aa84077ac4
87 changed files with 1573 additions and 574 deletions
54
dev/Storage/Client.js
Normal file
54
dev/Storage/Client.js
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function ClientStorage()
|
||||
{
|
||||
var
|
||||
NextStorageDriver = require('_').find([
|
||||
require('Common/ClientStorageDriver/LocalStorage'),
|
||||
require('Common/ClientStorageDriver/Cookie')
|
||||
], function (NextStorageDriver) {
|
||||
return NextStorageDriver && NextStorageDriver.supported();
|
||||
})
|
||||
;
|
||||
|
||||
this.oDriver = null;
|
||||
|
||||
if (NextStorageDriver)
|
||||
{
|
||||
this.oDriver = new NextStorageDriver();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {LocalStorageDriver|CookieDriver|null}
|
||||
*/
|
||||
ClientStorage.prototype.oDriver = null;
|
||||
|
||||
/**
|
||||
* @param {number} iKey
|
||||
* @param {*} mData
|
||||
* @return {boolean}
|
||||
*/
|
||||
ClientStorage.prototype.set = function (iKey, mData)
|
||||
{
|
||||
return this.oDriver ? this.oDriver.set('p' + iKey, mData) : false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} iKey
|
||||
* @return {*}
|
||||
*/
|
||||
ClientStorage.prototype.get = function (iKey)
|
||||
{
|
||||
return this.oDriver ? this.oDriver.get('p' + iKey) : null;
|
||||
};
|
||||
|
||||
module.exports = new ClientStorage();
|
||||
|
||||
}());
|
||||
Loading…
Add table
Add a link
Reference in a new issue