fix: possible workaround?
This commit is contained in:
parent
6aacf40125
commit
757e148032
@ -327,6 +327,7 @@ export class StorageManager {
|
|||||||
const url = (options.history && options.history.url) || (this._global.document && this._global.document.location);
|
const url = (options.history && options.history.url) || (this._global.document && this._global.document.location);
|
||||||
|
|
||||||
const state = this._global.history.state || {};
|
const state = this._global.history.state || {};
|
||||||
|
//alert('Current State of history: ' + JSON.stringify(state));
|
||||||
state[this.namespace] = this._updateStorage({}, value, LOCATION.HISTORY, options);
|
state[this.namespace] = this._updateStorage({}, value, LOCATION.HISTORY, options);
|
||||||
|
|
||||||
this._debugLog('_saveToHistory', { state: state, push: push, title: title, url: url});
|
this._debugLog('_saveToHistory', { state: state, push: push, title: title, url: url});
|
||||||
@ -359,6 +360,12 @@ export class StorageManager {
|
|||||||
|
|
||||||
addHistoryListener(listener, options=this._options, ...args) {
|
addHistoryListener(listener, options=this._options, ...args) {
|
||||||
const modified_listener = (function(event, ...listener_args) { // eslint-disable-line no-unused-vars
|
const modified_listener = (function(event, ...listener_args) { // eslint-disable-line no-unused-vars
|
||||||
|
alert('Event:' + JSON.stringify(event));
|
||||||
|
|
||||||
|
//possible solution: popstate event does not have a state
|
||||||
|
if(event.state === null)
|
||||||
|
return;
|
||||||
|
|
||||||
this._global.setTimeout(() => listener(this._getFromHistory(options), ...listener_args));
|
this._global.setTimeout(() => listener(this._getFromHistory(options), ...listener_args));
|
||||||
}).bind(this);
|
}).bind(this);
|
||||||
|
|
||||||
@ -472,10 +479,10 @@ export class StorageManager {
|
|||||||
}).catch(console.error);
|
}).catch(console.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
_debugLog() {}
|
//_debugLog() {}
|
||||||
// _debugLog(fName, ...args) {
|
_debugLog(fName, ...args) {
|
||||||
// console.log(`[DEBUGLOG] StorageManager.${fName}`, { args: args, instance: this });
|
console.log(`[DEBUGLOG] StorageManager.${fName}`, { args: args, instance: this });
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user