Hacker News new | ask | show | jobs
by aib 2248 days ago
Are userscripts still run once after page load? That was a major pain point last time I tried using them, on a dynamic page. I tried hooking some events and run-registered-function-on-tree-change-but-at-most-at-N-msec-intervals, but it got out of hand and ended up looking to take much more time to write than the handler it was going to call, so I filed it under "should be written once and properly" and postponed the whole thing.
1 comments

MutationObserver should do the trick if you can pick elements which consistently change at times you'd want to re-run. Watching for <title> changes tends to be good for single page apps.