Releases: dumbmatter/promise-worker-bi
v5.0.1
v5.0.0
Modernize codebase, require Node.js 20+, drop CommonJS build.
v4.1.1
Fixed the ESM build.
v4.1.0
Added support for transferable objects in messages and responses from both the host and worker. Example:
const buffer = new ArrayBuffer(1);
promiseWorker.postMessage(buffer, undefined, [buffer]);
promiseWorker.register(async (buffer) => {
const processed = await processBuffer(buffer);
return {
message: processed,
_PWB_TRANSFER: [processed.someTransferableProprty],
};
});
v4.0.3
v4.0.2
Upgrade dependencies, fix for TypeScript 3.9 while breaking for any older versions of TypeScript.
v4.0.1
Switched from Flow to TypeScript, cause momentum. Sadly TypeScript sucks at supporting shared workers, so the typings are a bit worse, but promise-worker-bi works the same.
v4.0.0
Split the old PromiseWorker class into two separate classes PWBHost and PWBWorker, so they can be included separately in main and worker bundles, leading to smaller bundle sizes if you use tree shaking and dead code elimination. Savings seems to just be a couple kb of minified JS per bundle, but every byte counts!
v3.0.2
This should obviously print "true":
blob = new Blob(["self.onmessage = function() {};"], { type: "text/javascript" });
worker = new Worker(window.URL.createObjectURL(blob));
console.log(worker instanceof Worker);
However in some rare cases, it will print "false" in Safari. This caused bugs in prior versions of promise-worker-bi, but this release includes a workaround.
v3.0.1
Restore console.error
logging for errors in the worker, because otherwise it can be difficult to debug live since the errors sent back to the window by promise-worker-pi do not have source maps applied.