Multiple questions actually:
Will importScripts
always load the scripts with a GET request or can it cache scripts?
Can importScripts
access scripts cached in the main thread or browser context?
Can the worker cache scripts for the main thread to access? (simply the other way around)
importScripts will not load the script again if you specify http cache headers like 'Expires' or 'Cache-control' properly, see google recomendations about that
There is a kind of 'gateway filter' between threads, that allows primitives like booleans, strings to go through but not objects/functions. If you load your script via XHR as a string in main thread, you'll probably be able to send it to the worker thread and eval there.
See the answer #1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With