You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a use case that I believe is quite common in JS frameworks.
We are using LocalStorage for caching app assets (js, css, html templates, etc.). To offload the main thread we use web workers, that xhr the app assets from the server. Ideally we would compress and save to LocalStorage in a web worker, but they do not have access to LS.
So, we need to compress in web worker, pass the result via postMessage to the main and then save arraybuffer to LocalStorage. To avoid expensive copy, postMessage allows to pass the result as a 'transferable' arraybuffer.
So it seems converting a compressed arraybuffer to utf16 needs to be done in a separate pass on the main thread.
The text was updated successfully, but these errors were encountered:
I haven't tackled these issues yet due to the poor support in IE. IE10 still being the odd IE in terms of usage, it doesn't make sense for me yet to add typed array support by fear of breaking things on IE8-.
In all my apps I communicate to my workers with a straight String and while not perfect, it works fine for me.
Releasing an implementation that outputs a typed array instead of a string is trivial. Just update the writeBit and (and readBit for the decompressor) in LZString 1.0.3. With an Uint16Array it should really be trivial.
I have a use case that I believe is quite common in JS frameworks.
We are using LocalStorage for caching app assets (js, css, html templates, etc.). To offload the main thread we use web workers, that xhr the app assets from the server. Ideally we would compress and save to LocalStorage in a web worker, but they do not have access to LS.
So, we need to compress in web worker, pass the result via postMessage to the main and then save arraybuffer to LocalStorage. To avoid expensive copy, postMessage allows to pass the result as a 'transferable' arraybuffer.
So it seems converting a compressed arraybuffer to utf16 needs to be done in a separate pass on the main thread.
The text was updated successfully, but these errors were encountered: