Class ImageWorker
Defined in: image-worker/worker.ts:32
Runs inside a Worker or SharedWorker to fetch images on behalf of one or more ImageFetch instances running on the main thread(s) that connect to it.
Each connecting thread registers itself by sending a connect message along with a MessagePort. When a thread sends a load request for a url, the worker fetches the image via fetch, converts the response into a Blob, and creates an object url for it via URL.createObjectURL. The fetch for a given url is deduped and cached in-memory for the lifetime of the worker, so repeat load requests for the same url — whether from the same or a different connected thread — do not trigger another network request.
Only intended for use inside a Worker context: constructing an ImageWorker on the main thread is a no-op.
Constructors
Constructor
new ImageWorker(options?): ImageWorker;Defined in: image-worker/worker.ts:42
Parameters
options?
persisted
boolean
reserved for a future on-disk cache; currently unused.
Returns
ImageWorker