0
fetch('abc.webp')
    .then(processStatus)
        .then(parseBlob)
            .then(myBlob => {
                  var objURL = URL.createObjectURL(myBlob);
            });

and then just send this image to the main worker to render on the page? If not so then how would I do it so that the image be decoded in the worker thread and then sent to main thread for rendering.

bmayank
  • 1
  • 1
  • 7
  • Yes, `Worker` has its own scope. – guest271314 Jan 27 '18 at 07:25
  • So that means that if I download an image in web worker than it would download and decode that image or video blob and then pass it to the main thread? Am I getting it right? – bmayank Jan 27 '18 at 09:39
  • Yes. See [WorkerGlobalScope](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope) – guest271314 Jan 27 '18 at 16:09
  • You can convert the image to an `ArrayBuffer` and transfer the buffer to the main thread, see [createImageBitmap alternative on Safari](https://stackoverflow.com/questions/40094245/createimagebitmap-alternative-on-safari/) – guest271314 Jan 27 '18 at 16:26

0 Answers0