Open Sherry0901 opened 2 years ago
Hi, please check the following example: https://github.com/jerryscript-project/jerryscript/blob/master/docs/02.API-REFERENCE.md#jerry_context_alloc
thanks! I see, so JerryScript can create multi-threads. But I am still confused about the details. How can I implement postMessage,addEventListener,removeEventListener...in JerryScript? @rerobika
I see, so JerryScript can create multi-threads.
Nope, JerryScript cannot create threads. The linked example only shows that the engine is able to work in a multi threaded context. Please note that those independent contexts cannot pass value to each other.
If I were you I'd definitely use Promises or async functions to build and own event queue to handle the listener events. However, it's still single threaded, but the jobs can communicate with each other.
Thanks for your advice! I'll try it.
Is it possible to implement worker(like web worker) in JerryScript? if it's available, where can I get some examples or guides?