MCPcopy Create free account
hub / github.com/violentmonkey/violentmonkey / setRoute

Function setRoute

src/common/router.js:40–50  ·  view source on GitHub ↗
(hash, replace, noConfirm)

Source from the content-addressed store, hash-verified

38addEventListener('hashchange', () => updateRoute(), false);
39
40export function setRoute(hash, replace, noConfirm) {
41 let hashString = `${hash}`;
42 if (hashString[0] !== '#') hashString = `#${hashString}`;
43 if (replace) {
44 window.history.replaceState('', null, hashString);
45 } else {
46 stack.push(Object.assign({}, route));
47 window.history.pushState('', null, hashString);
48 }
49 updateRoute(noConfirm);
50}
51
52export function getUnloadSentry(onConfirm, onCancel) {
53 async function confirmPopState(hash) {

Callers 2

updateRouteFunction · 0.85
confirmPopStateFunction · 0.85

Calls 1

updateRouteFunction · 0.85

Tested by

no test coverage detected