/// <reference lib="webworker" />
export const { Worker, TransformStream } = globalThis;
/** add message callback */
export function onMessage(callback) {
    self.addEventListener('message', (ev) => {
        callback(ev.data);
    });
}
/** post message */
export function postMessage(value, transfer) {
    self.postMessage(value, transfer);
}
export const MAX_WORKERS = Math.max(globalThis.navigator?.hardwareConcurrency ?? 4, 2) - 1;
//# sourceMappingURL=browser.js.map