Scheduler.asap doesn't use `nextTick`?
See original GitHub issueRxJS version:
5.4.0
process.nextTick(() => { console.log('nextTick 1'); });
setImmediate(() => { console.log('setImmediate 1'); });
Observable.of('now!', Scheduler.asap).subscribe(x => console.log(x));
setImmediate(() => { console.log('setImmediate 2'); });
process.nextTick(() => { console.log('nextTick 2'); });
Expected behavior:
"nextTick 1"
"now!"
"nextTick 2"
"setImmediate 1"
"setImmediate 2"
Actual behavior:
"nextTick 1"
"nextTick 2"
"setImmediate 1"
"now!"
"setImmediate 2"
Additional information:
Am I misunderstanding something? I reached for the asap scheduler because the docs say it’s supposed to schedule using nextTick (when available), but it doesn’t appear to be doing so.
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
RxJS Working with Scheduler - Javatpoint
An RxJS Scheduler is a way to control the timing strategy used to execute tasks in RxJS apps or reactive applications ... nextTick,...
Read more >node.js - RxJS Schedulers - Stack Overflow
It doesn't use setImmediate, but Promise.then . Since it won't go to the next tick until the microtasks queue is empty, I think...
Read more ><Lazy> rendering in Vue to improve performance - Medium
It's just two levels of scheduling: ASAP and “a bit later” and for the ... Only this time we'll use a bit more...
Read more >How to Use nextTick() in Vue - Dmitri Pavlutin
nextTick (callback) . It executes callback right after the new data updates have reached DOM.
Read more >eggheadio-projects/step-by-step-async-javascript-with-rxjs: null
By default subscription to Observable calls `func` * synchronously, but using `Scheduler.async` as last parameter will defer call to input function, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@benlesh I think what @matthewwithanm is pointing out is that setImmediate isn’t the microtask scheduling method (see here). Furthermore, setImmediate docs on MDN seem to indicate setImmediate is dead, so we should probably find an alternative.
@matthewwithanm hey Matt, sorry for the confusion. The asap scheduler attempts to use setImmediate, and falls back to nextTick if it isn’t available (you can see how it’s resolved here). Let me know if you have any suggestions on a better approach.