Changing the browser.worker API #2143
PierreQuentel
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In issue #2135, Ben Levitt reported that in the current implementation, stdlib modules are not cached in indexedDB, resulting in uselessly long loading times.
To support this feature, since indexedDB is asynchronous, loading a web worker from Brython must also be asynchronous.
While keeping the current version with the
Worker
class for backwards compatibility, I propose to add a new functioncreate_worker(worker_id, onready, onmessage, onerror)
that loads the Web Worker identified byworker_id
andonready
when the indexedDB cache is loadedonmessage
every time the worker sends a messageonerror
in case an error occurs in the workerMore detail in the module documentation.
Any comment / suggestion on this new API is welcome.
Beta Was this translation helpful? Give feedback.
All reactions