update sync display
This commit is contained in:
parent
0d51412424
commit
a52b5e24d0
20 changed files with 181 additions and 147 deletions
47
dashboard-ui/bower_components/emby-apiclient/appstorage-cache.js
vendored
Normal file
47
dashboard-ui/bower_components/emby-apiclient/appstorage-cache.js
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
define([], function () {
|
||||
|
||||
var myStore = {};
|
||||
var cache;
|
||||
var localData;
|
||||
|
||||
function updateCache() {
|
||||
cache.put('data', new Response(JSON.stringify(localData)));
|
||||
}
|
||||
|
||||
myStore.setItem = function (name, value) {
|
||||
|
||||
if (localData) {
|
||||
var changed = localData[name] != value;
|
||||
|
||||
if (changed) {
|
||||
localData[name] = value;
|
||||
updateCache();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
myStore.getItem = function (name) {
|
||||
|
||||
if (localData) {
|
||||
return localData[name];
|
||||
}
|
||||
};
|
||||
|
||||
myStore.removeItem = function (name) {
|
||||
|
||||
if (localData) {
|
||||
localData[name] = null;
|
||||
delete localData[name];
|
||||
updateCache();
|
||||
}
|
||||
};
|
||||
|
||||
myStore.init = function () {
|
||||
return caches.open('embydata').then(function (result) {
|
||||
cache = result;
|
||||
localData = {};
|
||||
});
|
||||
};
|
||||
|
||||
return myStore;
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue