@rfindley
Can I request a feature related to on_pageload?
I would like for scripts to have a simple way to handle the user exiting the desired page.
In particular, this is useful for any listeners added or modifications made to window or document.body. Think of it like a finally block, where script cleanup can occur.
You may want to read my recent post(s) in the Jitai thread if you want a better idea of where I’m coming from.
Theoretically, this could be quite elegant, such that the firing of the on_pageload callback acts as an on switch for this second callback, which is then fired once and switched back off when the page navigates somewhere that fails the regex for the earlier callback, and/or perhaps it just checks if the previous URL matched the regex (and the upcoming URL does not). Though a more basic example could just have it act as a negative version of on_pageload’s regex test. The latter would result in more calls, which could technically have performance side effects and is a bit undesirable from a conceptual standpoint, but it also is probably much easier to create, and something is better than nothing, so that’s why I am proposing both.