JS: Introuce Icinga.History.replaceCurrentState()
Before, we only had pushCurrentState() to add a new URL to the history stack. But some actions, e.g. "load more" in history views require to replace the current state instead of pushing. This is what replaceCurrentState() supports now.
This commit is contained in:
parent
97006973d8
commit
71b8ab9b68
|
@ -114,6 +114,26 @@
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Replace the current history entry with the current state
|
||||
*/
|
||||
replaceCurrentState: function () {
|
||||
if (! this.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
var state = this.getCurrentState();
|
||||
|
||||
if (state.url) {
|
||||
this.icinga.logger.debug('Replacing current history state');
|
||||
window.history.replaceState(
|
||||
this.getBehaviorState(),
|
||||
null,
|
||||
state.url
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Push the given url as the new history state, unless the history is disabled
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue