generated from ipfs/ipfs-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
Description
Blocks: ipfs/ipfs-companion#1127
Related: Countly/countly-sdk-web#382
The issue:
countly-web-sdkships as an iife which bundles everything, including dependence onwindowobject and implementsXMLHttpRequest. Both of these are blockers for implement countly in webworkers (companion background worker and service workers)
Proposed Fix:
- Since not all APIs are used by ignite-metrics, it's possible to write a minimal set of function calls that can call countly endpoints from within the webworker.
- APIs Needed:
- Authentication Flow
- Session Create Flow
- Push Event Flow
- Other considerations:
- We already implement an eventAccumulator
- We will need a batching mechanism to not overwhelm the endpoint.
- Limitations:
- webworkers don't have access to
DOM,window,XMLHttpRequestandlocalStorage, so:- use
fetchto open connections to countly endpoints - use
indexedDBfor storage needs. The browser API is awful to use, but projects likeDexieprovide a decent API to work withindexedDB.
- use
- webworkers don't have access to
- Shipping:
- Since webpack supports
webworkerbuild target as of v5. We can simply provide an export target without changing a lot of things.
- Since webpack supports
Other Thoughts
- If countly can implement a modular SDK, we might be able to treeshake most of unreachable code and shim
windowif still needed. - In the short term this can help unblock and have light and sane way of communicating with countly.
CC: @SgtPooki