-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Priority: LowLow priority.Low priority.
Description
Motivation
It may be desirable to know whether the worker has already started. As a minimum this could help in testing.
Technical Specification
Consumers would add a method whose sole purpose is to confirm the worker is running, like ping:
epxort const myWorker = {
ping() { return 'pong'; },
...
}Then, AsyncWorker would have an awaitable method that calls it:
const worker = new Worker(new URL(..., import.meta.url), { type: 'module' });
const wrapper = new AsyncWorker(worker, myWorker);
...
await wrapper.ensureReady(/* maybe with an optional timeout? */);
Internally, AsyncWorker.ensureReady() would simply invoke the myWorker.ping() task and would wait on its work item's promise. The return value would be discarded.
Metadata
Metadata
Assignees
Labels
Priority: LowLow priority.Low priority.