mirror of
https://github.com/NeonGamerBot-QK/saahild.com.git
synced 2025-05-14 01:13:05 +00:00
Make Hashrouter auto switch inline
This commit is contained in:
parent
87c4f48258
commit
372f16b010
3 changed files with 13 additions and 30 deletions
|
@ -1,25 +0,0 @@
|
|||
let interId:any = null
|
||||
function hashEvent() {
|
||||
window.location.reload() // ;-;
|
||||
}
|
||||
export function startEvent() {
|
||||
if ("onhashchange" in window) {
|
||||
window.addEventListener('hashchange', hashEvent)
|
||||
}
|
||||
else {
|
||||
//@ts-ignore
|
||||
var prevHash = window.location.hash;
|
||||
//@ts-ignore
|
||||
interId = window.setInterval(function () {
|
||||
if (window.location.hash != prevHash) {
|
||||
hashEvent()
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export function stopEvent() {
|
||||
if(interId) clearInterval(interId)
|
||||
window.removeEventListener('hashchange', hashEvent)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue