feature: the beginnings of chat working
This commit is contained in:
parent
85024c6e62
commit
649ff432bb
24 changed files with 1555 additions and 918 deletions
22
public/js/locationchange.js
Normal file
22
public/js/locationchange.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
// https://stackoverflow.com/questions/6390341/how-to-detect-if-url-has-changed-after-hash-in-javascript
|
||||
(() => {
|
||||
let oldPushState = history.pushState;
|
||||
history.pushState = function pushState() {
|
||||
let ret = oldPushState.apply(this, arguments);
|
||||
window.dispatchEvent(new Event("pushstate"));
|
||||
window.dispatchEvent(new Event("locationchange"));
|
||||
return ret;
|
||||
};
|
||||
|
||||
let oldReplaceState = history.replaceState;
|
||||
history.replaceState = function replaceState() {
|
||||
let ret = oldReplaceState.apply(this, arguments);
|
||||
window.dispatchEvent(new Event("replacestate"));
|
||||
window.dispatchEvent(new Event("locationchange"));
|
||||
return ret;
|
||||
};
|
||||
|
||||
window.addEventListener("popstate", () => {
|
||||
window.dispatchEvent(new Event("locationchange"));
|
||||
});
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue