It is necessary or practical for many features to query information about tabs and the pages they show. E.g. to access the referrer page/tab, the http headers, and other things that cannot be obtained from the browser API (except in certain event handlers).
I am thinking it may be worth to make this isolated and generic, to make it reusable in other projects. In a sense it would provide an alternative browser API. It would listen to various browser events and collect their data in a simple data structure. I am not sure about the desired structure: it could have an object with info for each current (possibly also previous?) tab; or it could be more like a queryable event log (datascript comes to mind).
Things like tracking the time and scroll would also need to keep state.
It is necessary or practical for many features to query information about tabs and the pages they show. E.g. to access the referrer page/tab, the http headers, and other things that cannot be obtained from the browser API (except in certain event handlers).
I am thinking it may be worth to make this isolated and generic, to make it reusable in other projects. In a sense it would provide an alternative browser API. It would listen to various browser events and collect their data in a simple data structure. I am not sure about the desired structure: it could have an object with info for each current (possibly also previous?) tab; or it could be more like a queryable event log (datascript comes to mind).
Things like tracking the time and scroll would also need to keep state.