diff options
Diffstat (limited to 'ext/js/display/display-history.js')
-rw-r--r-- | ext/js/display/display-history.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ext/js/display/display-history.js b/ext/js/display/display-history.js index bc4f1539..183368d0 100644 --- a/ext/js/display/display-history.js +++ b/ext/js/display/display-history.js @@ -17,7 +17,8 @@ */ import {EventDispatcher} from '../core/event-dispatcher.js'; -import {generateId, isObject} from '../core/utilities.js'; +import {isObjectNotArray} from '../core/object-utilities.js'; +import {generateId} from '../core/utilities.js'; /** * @augments EventDispatcher<import('display-history').Events> @@ -38,12 +39,12 @@ export class DisplayHistory extends EventDispatcher { const historyState = history.state; const {id, state} = ( - typeof historyState === 'object' && historyState !== null ? + isObjectNotArray(historyState) ? historyState : {id: null, state: null} ); /** @type {?import('display-history').EntryState} */ - const stateObject = typeof state === 'object' || state === null ? state : null; + const stateObject = isObjectNotArray(state) ? state : null; /** @type {import('display-history').Entry} */ this._current = this._createHistoryEntry(id, location.href, stateObject, null, null); } @@ -189,7 +190,7 @@ export class DisplayHistory extends EventDispatcher { _updateStateFromHistory() { let state = history.state; let id = null; - if (isObject(state)) { + if (isObjectNotArray(state)) { id = state.id; if (typeof id === 'string') { const entry = this._historyMap.get(id); |