mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 15:54:03 +02:00
storage.js: Don't try and allow to register events for non-local backends
This commit is contained in:
parent
62d4e73d5a
commit
5849c06314
@ -171,6 +171,10 @@
|
|||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
onChange: function(key, callback, context) {
|
onChange: function(key, callback, context) {
|
||||||
|
if (this.backend !== window.localStorage) {
|
||||||
|
throw new Error('[Storage] Only the localStorage emits events');
|
||||||
|
}
|
||||||
|
|
||||||
var prefixedKey = this.prefixKey(key);
|
var prefixedKey = this.prefixKey(key);
|
||||||
|
|
||||||
if (typeof Icinga.Storage.subscribers[prefixedKey] === 'undefined') {
|
if (typeof Icinga.Storage.subscribers[prefixedKey] === 'undefined') {
|
||||||
@ -273,7 +277,10 @@
|
|||||||
this.storage = storage;
|
this.storage = storage;
|
||||||
this.key = key;
|
this.key = key;
|
||||||
|
|
||||||
|
if (storage.backend === window.localStorage) {
|
||||||
storage.onChange(key, this.onChange, this);
|
storage.onChange(key, this.onChange, this);
|
||||||
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user