history#LocationListener TypeScript Examples
The following examples show how to use
history#LocationListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Router.spec.ts From next-core with GNU General Public License v3.0 | 6 votes |
spyOnHistory = {
location: {
pathname: "/yo",
} as unknown as Location,
listen: jest.fn((fn: LocationListener) => {
historyListeners.push(fn);
return () => {
const index = historyListeners.indexOf(fn);
if (index >= 0) {
historyListeners.splice(index, 1);
}
};
}),
replace: jest.fn(),
block: jest.fn((fn) => {
blockFn = fn;
}),
createHref: () => "/oops",
setBlockMessage,
getBlockMessage,
unblock,
}
Example #2
Source File: Router.spec.ts From next-core with GNU General Public License v3.0 | 5 votes |
historyListeners: LocationListener[] = []