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

Code samples aren't working #139

Open
jared201 opened this issue Nov 21, 2016 · 6 comments
Open

Code samples aren't working #139

jared201 opened this issue Nov 21, 2016 · 6 comments

Comments

@jared201
Copy link

Code snippet:

				`var worker = cw(function(a,callback){
				    callback(a[0]+a[1]);
				});
			        worker.data([2,5]).then(function(a){
				    console.log("One worker: " + a + " -- " + new Date());
				})//prints 7
			        worker.close();//close it up`

and no errors are getting shown as well.

@calvinmetcalf
Copy link
Owner

are you running this in the console or as a script ?

@jared201
Copy link
Author

thanks for the quick reply, i'm running it in the console as i'm trying to test whether the function is being called, but when I'm running IE11 debugger it doesn't look like it's executing the function but no error is being shown either.

@calvinmetcalf
Copy link
Owner

so the function is stringified and run in a web worker so simply using a debugger statment isn't going to help

@jared201
Copy link
Author

ok, just added another option to the callback to handle rejected calls and that's where it's ending. Now, I wonder why the call is being rejected?

@jared201
Copy link
Author

just an update after removing the worker.close(); the function is being called but it's being rejected first then it will be called later. Weird.

@calvinmetcalf
Copy link
Owner

ah yes so the worker is async but you are closing the worker sync so that does explain why it's randomly dying

running

var worker = cw(function(a,callback){
				    callback(a[0]+a[1]);
				});
			        worker.data([2,5]).then(function(a){
				    console.log("One worker: " + a + " -- " + new Date());
				})//prints 7

works as expected printing One worker: 7 -- Tue Nov 22 2016 08:07:03 GMT-0500 (EST)

there are some issues with workers in IE, there is a corectly configured version running at http://catilinejs.com/ so you could try in the console there and see if you still have the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants