Open FranckFreiburger opened 1 year ago
I wondering how to deal with programatically created promises (jerry_promise()) and jerry_run_jobs() call or (calls !) I try to implement a setTimeout native function that returns a promise.
jerry_promise()
jerry_run_jobs()
script:
new Promise(function(resolve) { resolve('Hello, World!'); }) .then(function(x) { print(x); return setTimeout(1000); }) .then(function(x) { print('timeout Ok'); })
pseudo main.c (partially from API-REFERENCE)
run the script while (true) ret = jerry_run_jobs() if ret is not an exception break;
output:
Hello, World!
... I also expect to see "timeout Ok"
undefined
jerry_promise_on_event
I wondering how to deal with programatically created promises (
jerry_promise()
) andjerry_run_jobs()
call or (calls !) I try to implement a setTimeout native function that returns a promise.script:
pseudo main.c (partially from API-REFERENCE)
output:
... I also expect to see "timeout Ok"
jerry_run_jobs()
returnsundefined
?jerry_promise_on_event
to count my promises, and exit if it reach 0 ?