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

21 lines
459 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
*/
/** @type {MessagePort} */
let implPort;
onmessage = async (evt) => {
const module = await import(evt.data.implSrc);
module.connect(evt.ports[0]);
};