Constructor
new WorkerWrapper(worker)
Parameters:
Name | Type | Description |
---|---|---|
worker |
Worker | the worker to wrap |
Methods
getJobCount() → {Number}
Get the number of jobs currently running
Returns:
the number of jobs currently running
- Type
- Number
newJobId() → {Number}
Get a new job id
Returns:
the new job id
- Type
- Number
submitJob(message, transferablesopt) → {Promise}
Submit a job to the worker
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
Object | the message to send to the worker. A "jobId" property will be added to this object. |
|
transferables |
Array.<Object> |
<optional> |
an optional array of transferable objects to transfer to the worker. |
Returns:
a promise that gets resolved/rejected when a message with the same jobId is received from the worker.
- Type
- Promise