Skip to content

Clean web workers using callbacks

github.com/BigIroh
1 pointmako-tacodiscuss
On HN

This library is a project I made to make web worker code easier to write and easier to read. As they stand, getting use out of web workers involves writing a series of messages and responses that are not standardized in any way between authors. The library I have created, Ozai, creates a web worker by passing a javascript object literal to its constructor. The result is a client-side object which represents the web worker. Instead of passing arbitrary messages, the author calls functions that are obvious to anyone reading the code, and passes them callbacks to fire when then web worker has completed its job.

Comments

No comments yet.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.