plugins
plugins copied to clipboard
🧩 logseq.App.onRouteChanged
Currently, there is a bug. The callback is not returned every time. Therefore, it must be used in conjunction with onPageHeadActionsSlotted() to guarantee that it works.
const processing = false
logseq.App.onRouteChanged(async ()=> {
if(processing) return
setTimeout(() => { processing = false }, 1000)
processing = true
routeChanged()
})
logseq.App.onPageHeadActionsSlotted(async () => {
if(processing) return
setTimeout(() => { processing = false }, 1000)
processing = true
routeChanged()
})
const routeChanged = () => {
// Here
}
🤔 Seems to work for me unless I am missing something. Is there a reproducible example where the callback is not triggered?