1
0
Fork 0
mirror of https://github.com/codedread/bitjs synced 2025-10-04 01:59:15 +02:00
bitjs/archive/unarchiver-webworker.js

22 lines
524 B
JavaScript

/**
* unarchiver-webworker.js
*
* Licensed under the MIT License
*
* Copyright(c) 2023 Google Inc.
*/
/**
* A WebWorker wrapper for a decompress implementation. Upon creation and being
* sent its first message, it dynamically loads the correct decompressor and
* connects the message port. All other communication takes place over the
* MessageChannel.
*/
/** @type {MessagePort} */
let implPort;
onmessage = async (evt) => {
const module = await import(evt.data.implSrc);
module.connect(evt.ports[0]);
};