Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bergos/worker-utils
https://github.com/bergos/worker-utils
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bergos/worker-utils
- Owner: bergos
- License: mit
- Created: 2013-08-30T20:48:13.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-08-31T16:50:15.000Z (over 11 years ago)
- Last Synced: 2024-04-14T18:21:41.527Z (10 months ago)
- Language: JavaScript
- Size: 105 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WorkerUtils
WorkerUtils contains useful functions and classes for [Web Workers](http://www.whatwg.org/specs/web-workers/current-work/).
## ParallelWorker
A ParallelWorker has a transparent interface to handle multiple Web Workers. Messages will be forwarded to free workers or queued until free workers are available. The worker is not allowed to send intermediate message and must send only a single message for every incoming message at the end of the computation. This is a requirement to detect running/free workers.
### [Constructor(DOMString scriptURL, numberOfWorkers)]
Beside the URL of the worker script the number of worker instances is a required parameter for the constructor.
### void postBroadcastMessage(any message);
The `postBroadcastMessage` method sends a message to all workers. This may be useful for initialization purposes. A response to this message is not required.
### attribute EventHandler emptyqueue;
The `emptyqueue` event is fired when all workers are ready and there are no queued messages.