Skip to main content

History

The History class is used for working with the history package. It creates a new instance and subscribes to location changes via the EventManager. It wraps history and provides a SuspenseHistory interface which has an attribute called isPending to show if a navigation is pending right now.

The class itself is not exported from @archibald/core — retrieve the shared instance through the HistoryManager:

import { HistoryManager } from '@archibald/core';

const history = HistoryManager.getInstance();

get

This method retrieves the underlying SuspenseHistory instance.

const suspenseHistory = HistoryManager.getInstance().get();

listen

This method subscribes to location changes.

const unlisten = HistoryManager.getInstance().listen(PARAMETERS);

Parameters

NameTypeDescription
callbackListenerA callback function to execute when the location changes.