Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have an idea how to improve the work with Service Worker (decoders) #983

Closed
GlosusHidden opened this issue Aug 20, 2021 · 3 comments
Closed
Labels
enhancement New feature or request question Further information is requested
Milestone

Comments

@GlosusHidden
Copy link

GlosusHidden commented Aug 20, 2021

For example, you need to open a file of 100 slides that need to be processed through the decoder jpeg2000.
So every time you download decode-jpeg2000 and then 'jpx.js', 'util.js', 'arithmetic_decoder.js' from importScritps.

It seems to me that this is not very good. It is a lot of traffic and you need to store decoders somewhere in the internet.

So idea:

  1. Merge decoder and all it's importScritps in one file
  2. Squeeze it
  3. Import it as string
    const jpeg2000 = require('raw-loader!./jpeg2000.js');
  4. Convert to Blob:
    const jpeg2000Blob = new Blob([jpeg2000], {type: 'application/javascript'})
  5. Create URL from Blob:
    URL.createObjectURL(jpeg2000Blob)
  6. Use this result URL as decoderScripts for library.

Then everything will work offline

@ivmartel ivmartel added the question Further information is requested label Sep 3, 2021
@ivmartel ivmartel added this to the 0.30.0 milestone Sep 3, 2021
@ivmartel
Copy link
Owner

ivmartel commented Sep 6, 2021

Thanks, it looks interesting! I guess it is similar to what is done in the background of the web-workers handling of webpack.

@ivmartel
Copy link
Owner

ivmartel commented Sep 6, 2021

It also made me realise about #993, so thanks again!

@ivmartel
Copy link
Owner

Follow #1127 for progress.

@ivmartel ivmartel added the enhancement New feature or request label Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants