PATH:
usr
/
local
/
jetapps
/
frontend
/
jetbackup
/
app
/
services
'use strict'; define([ 'app' ], function (app) { app.factory('storage', [function() { var STORAGE = function(pool_name) { if(pool_name === undefined) throw Error("You must provide pool name"); this._storage_name = 'JetBackupStorage_' + pool_name; this._data = {}; var storageData = localStorage.getItem(this._storage_name); if(storageData === undefined) this.save(); else this.setData(JSON.parse(storageData)); }; STORAGE.prototype = { _storage_name: undefined, _data: null, set: function (key, value) { this._data[key] = value; }, get: function (key, defaultValue) { return this._data[key] !== undefined ? this._data[key] : defaultValue; }, isSet: function(key) { return this._data[key] !== undefined; }, remove: function(key) { delete this._data[key]; }, save: function() { localStorage.setItem(this._storage_name, JSON.stringify(this._data)); }, setData: function (data) { if(data) this._data = data; }, getData: function () { return this._data; }, destroy: function () { localStorage.removeItem(this._storage_name); this._data={}; } }; return { create: function(pool_name) { return new STORAGE(pool_name); }, delete: function (pool_name) { if(pool_name === undefined) throw Error("You must provide pool name"); localStorage.removeItem('JetBackupStorage_' + pool_name); }, deleteAll: function () { localStorage.clear(); }, exists: function (pool_name) { return !!localStorage.getItem('JetBackupStorage_' + pool_name); } }; }]); });
[-] utils.js
[edit]
[+]
..
[-] lang.js
[edit]
[-] jetapi.js
[edit]
[-] consts.js
[edit]
[-] storage.js
[edit]
[-] meta.js
[edit]
[-] backup.js
[edit]