bitpiston / rss-button-for-safari

Safari web extension for news feed discovery of RSS, Atom, JSON Feed & RDF+RSS.
https://rssdiscovery.app
MIT License
26 stars 1 forks source link

Investigate alternatives to polling for changes #52

Open einkoro opened 3 years ago

einkoro commented 3 years ago

For SPAs we currently poll as a ugly work around to the lack of any event for history changes not intimidated by the browser/user and lack of the webNavigation API.

Not polling would be preferred. On iOS it might even be required due to the lack of persistence to save battery life. I’m not sure offhand if content scripts are persistent at all.

If I remember correctly the current polling method would only catch the change if the URL changes but not the history or page content itself. If we must poll this should at least be cases we can cover.

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webNavigation

einkoro commented 3 years ago

MutationObserver for head seems like the way to go: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver