-
Notifications
You must be signed in to change notification settings - Fork 55
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
importScripts failing in ie9 #66
Comments
I've known about this one for a while, but couldn't figure out how to fix it, meaning I should really document it, the workaround for ie9 at the moment is to put a script tag in the body conditionally commented to only work in ie9 e.g. <!--[if IE 9]>
<script src="url''></script>
<![endif]--> this is not ideal, but anything that involves programmaticly putting the script in is going to have trouble guaranteeing that the script is downloaded when it's needed. |
ok realized there were 2 questions here that one I'll get back to you on, though I will point out that console.log inside a worker will explode in everywhere except IE9 |
I realize about the console.log outside of IE9, I just put it there for debugging. As for the IE9 conditional comment, I intend on using that script outside of webworkers as well, but at the moment its served for non-webworkers as part of a bundle. Are you ultimately saying that |
So it isn't actually failing silently it's passing an error to the onRejected function of the promise cw(function(){
inportScript('blah');
return 9;
}) .then(function(a){
console.log('yes ',a);
},function(a){
console.log('no ',a);
}); prints |
I had not tested the silent failing of |
the key is to do it in a way that ( in this order)
I think I'm going to have to use the stringification I use to make the worker on the stuff for ie9 and then manipulate the text before evaling it, In the mean time instead of cw(function(a){
inportScript('blah');
whatever
}) write cw({
init:function(){
inportScript('blah');
},
data:function(a){
whatever
}
}) this also gets around the bug in #59 |
i realize now I wrote |
you have no idea the levels of black magic to get import scripts to work in ie9 |
Um... do tell? |
as of v1.7.1 it uses the same procedure to turn the functions into a string in ie9 as in other ones, and then uses the same regex to move the scripts out of the main function, but then also regexes any function declaration inside the main object into function expressions, downloads the imported scrips via ajax, concats it all together and evals it. meanwhile the fake worker creation happens synchronously with calls to the fake worker queued up until after they all download. It's in pull #76. |
I am having two problems with the current release of communist and ie9
importScripts
js dies silently. When wrappingimportScripts
in a try catch I get :ReferenceError: 'importScripts' is undefined
.then
of the promise is not getting called in ie9 depending on the wrapper function. This one is hard to describe. Here is some coffeescript from my projectwhich produces the following logs in ie9
The text was updated successfully, but these errors were encountered: