Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Last revisionBoth sides next revision | ||
custom:javascript:callbacks [2021/04/04 20:49] – Remove use of "called" for "invoked" Deuce | custom:javascript:callbacks [2021/04/04 22:35] – Add more details to the event loop Deuce | ||
---|---|---|---|
Line 95: | Line 95: | ||
<code javascript> | <code javascript> | ||
while (js.do_callbacks && (timer_callback_count > 0 || polled_callback_count > 0 || run_queue.length > 0)) { | while (js.do_callbacks && (timer_callback_count > 0 || polled_callback_count > 0 || run_queue.length > 0)) { | ||
- | if (polled_callback_ready) { | + | |
+ | | ||
+ | timeout = 0; | ||
+ | poll_result = poll_callback_states(timeout); | ||
+ | if (poll_result.polled_callback_ready) { | ||
polled_callback.call(thisObj); | polled_callback.call(thisObj); | ||
continue; | continue; | ||
} | } | ||
- | if (timed_callback_ready) { | + | if (poll_result.timed_callback_ready) { |
timed_callback.call(thisObj); | timed_callback.call(thisObj); | ||
continue; | continue; | ||
} | } | ||
- | if (run_queue.length > 0) { | + | if (poll_result.run_queue.length > 0) { |
run_queue.shift().call(thisObj); | run_queue.shift().call(thisObj); | ||
continue; | continue; |