UNPKG

@synerty/vortexjs

Version:

Custom observable data serialisation and routing based on Angular 2+

15 lines (12 loc) 456 B
/// <reference lib="webworker" /> import * as pako from "pako"; import registerWebworker from "webworker-promise/lib/register"; registerWebworker(async (payloadJson, emit) => { const compressedData = pako.deflate(payloadJson); const compressedDataStr = new Uint8Array(compressedData).reduce( (acc: string, curr: number, i: number) => acc + String.fromCharCode(curr), "", ); return btoa(compressedDataStr); });