[TIMOB-26574] TiAPI: Implement set/clearImmediate
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-05-15T19:25:19.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 8.1.0 |
Components | TiAPI |
Labels | n/a |
Reporter | Christopher Williams |
Assignee | Christopher Williams |
Created | 2018-11-16T16:52:45.000+0000 |
Updated | 2019-05-28T13:57:41.000+0000 |
Description
setImmediate and clearImmediate are *sort of* like setTimeout/clearTimeout, but are supposed to be run after current I/O event callbacks are done.
https://nodejs.org/api/timers.html#timers_setimmediate_callback_args
Basically this is roughly like setTimeout(callback, 0); as a first stab, but should be run **before** and timeout callbacks.
In effect, immediate, timers and ticks from process.nextTick are *sort of* like 3 separate priorities of timer queues, although at a lower level they have semantic/behavioral differences. ticks are right away and can cause infinite loops. immediate come next chance after I/O events callbacks. Then timers get fired when ready.
https://github.com/appcelerator/titanium_mobile/pull/10863
merged to master with a suite of unit tests to verify behavior.
*Closing ticket*, fix verified in SDK version
8.1.0.v20190524131922
. *Tested with the following test case:*Output:
Test and other information can be found at: https://github.com/appcelerator/titanium_mobile/pull/10863 *Test Environment*