WebWorkers

For developers using the Construct 2 Javascript SDK

Post » Mon Feb 22, 2016 6:58 am

I was investigating how to move an expensive recursive routine in a plugin I'm working on into an asynchronous mechanism. I see that Pathfinding uses a WebWorker. In my search for other examples, the same Pathfinding code is actually duplicated in the cocoonjs_prelude.js and xdk_prelude.js files. @Ashley, is there something fundamental about using WebWorkers that would break if any third-party plugins that use this but the code isn't included in these two *_prelude files?

Thanks.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Mon Feb 22, 2016 12:04 pm

I think we had to paste the pathfinding code in to those files as one of the great many hacks necessary to work around missing features in non-browser engines. However we've dropped official support for both those platforms, so unless you want to bend over backwards to get your plugin working in deprecated platforms, don't worry about it.
Scirra Founder
B
398
S
236
G
88
Posts: 24,441
Reputation: 194,661

Post » Mon Feb 22, 2016 2:49 pm

Ah, frabjous news! Thanks.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Mon Feb 22, 2016 3:58 pm

I see what you did there.

Would it be possible to make a generic webworker plug? One where you could hand off intensive loops in events.
Image ImageImage
B
169
S
50
G
174
Posts: 8,331
Reputation: 110,806


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests