simple-web-worker icon indicating copy to clipboard operation
simple-web-worker copied to clipboard

when i depend on others lib in worker

Open npm-ued opened this issue 7 years ago • 2 comments

as the title when i depend on crypto-js in worker. What should I do? use importScripts?

npm-ued avatar Jun 07 '18 05:06 npm-ued

~@israelss yeah. Is importScripts supported on this library?~ @npm-ued try referencing it inside self in the worker function.

gamalielhere avatar Jun 14 '18 19:06 gamalielhere

It seems like importScripts is not supported ;(

I try this code inside worker function:

importScripts('scripts/lib.js')
self.importScripts('scripts/lib.js')

and I get Uncaught SyntaxError: Failed to execute 'importScripts' on 'WorkerGlobalScope'

floydback avatar Dec 15 '18 00:12 floydback