mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
7dfb9f1967
* initial commit of webconfig * update example config with webconfig and fix format of file update debian postinst script for install example config
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
/*global define, chrome */
|
|
define(['api/LocalStorage'], function (LocalStorage) {
|
|
'use strict';
|
|
return LocalStorage.subclass(/** @lends ChromeLocalStorage.prototype */{
|
|
|
|
/**
|
|
* @class ChromeLocalStorage
|
|
* @classdesc Chrome's persistent storage
|
|
* @constructs
|
|
* @extends LocalStorage
|
|
*/
|
|
constructor: function () {
|
|
},
|
|
|
|
get: function () {
|
|
chrome.storage.local.get('data', function (entry) {
|
|
if (chrome.runtime.lastError) {
|
|
this.emit('error', chrome.runtime.lastError.message);
|
|
} else {
|
|
this.emit('got', entry.data);
|
|
}
|
|
}.bind(this));
|
|
},
|
|
|
|
set: function (data) {
|
|
var entry = {};
|
|
entry.data = data;
|
|
chrome.storage.local.set(entry, function () {
|
|
if (chrome.runtime.lastError) {
|
|
this.emit('error', chrome.runtime.lastError.message);
|
|
} else {
|
|
this.emit('set');
|
|
}
|
|
}.bind(this));
|
|
}
|
|
});
|
|
});
|