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
21
G
222
Posts: 3,652
Reputation: 124,733

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
387
S
230
G
88
Posts: 24,251
Reputation: 192,464

Post » Mon Feb 22, 2016 2:49 pm

Ah, frabjous news! Thanks.
ImageImageImage
B
71
S
21
G
222
Posts: 3,652
Reputation: 124,733

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
168
S
50
G
164
Posts: 8,239
Reputation: 105,597


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests