mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-15 10:09:45 +00:00
* wip * doh, whitespace * Updating emscripten, restoring export name * Updating oxipng * Build wasm * Fix oxipng; upgrade Rust * More v2-codec integration * AVIF now working * Non-working JXL * Build hqx with Rust 1.40; refactor build-rust*.sh * Set web target * wp2 wip * wp2 decode options * Better logo height when loading the logo into squoosh * Build oxi * JAKE IS AN IDIOT * wip oxipng * Fixing case sensitive imports * adding log * another log * Abort tasks when compress component removed * Adding progressive option to JXL * Fix bug going to & from original image * Exposing epf in jxl * logs * Bypass initial CSS plugin * Revert "logs" * Adding root * Fix for finding TSC on Windows * Use spawn again * Converting to module paths * Remove spawnP * silly * oops * logs * Fixing glob paths in CSS plugin * Path normalising * Normalise paths for CSS plugin * Normalise again * Use correct func * Adding lossless mode and near lossless (but hidden in UI) * Removing useless comments * Some logging * Update JXL to v0.1. (#846) * Rebuild JXL * Adding slight loss option Co-authored-by: Ingvar Stepanyan <rreverser@google.com> Co-authored-by: Luca Versari <veluca93@gmail.com>
26 lines
770 B
TypeScript
26 lines
770 B
TypeScript
import initOxiPNG, {
|
|
start_worker_thread,
|
|
} from 'codecs/oxipng/pkg-parallel/squoosh_oxipng';
|
|
|
|
export type WorkerInit = [WebAssembly.Module, WebAssembly.Memory];
|
|
|
|
addEventListener(
|
|
'message',
|
|
async (event) => {
|
|
// Tell the "main" thread that we've received the message.
|
|
//
|
|
// At this point, the "main" thread can run Wasm that
|
|
// will synchronously block waiting on other atomics.
|
|
//
|
|
// Note that we don't need to wait for Wasm instantiation here - it's
|
|
// better to start main thread as early as possible, and then it blocks
|
|
// on a shared atomic anyway until Worker is fully ready.
|
|
// @ts-ignore
|
|
postMessage(null);
|
|
|
|
await initOxiPNG(...(event.data as WorkerInit));
|
|
start_worker_thread();
|
|
},
|
|
{ once: true },
|
|
);
|