3 ms·
There's lots of confusion what this is. Basically browser runs a giant eventloop. Whenever you call async function in javascript, it gets put into a queue, and
by Cloudef 4y ago
There's lots of confusion what this is. Basically browser runs a giant eventloop. Whenever you call async function in javascript, it gets put into a queue, and called by the event loop (usually the next execution). This basically makes it so that the async call gets tagged with metadata that tells the event queue "Don't call me unless you have nothing else to call". So basically it keeps the async call at the end of the queue until it's the final call, and that's when the eventloop will call it. The subject is quite misleading as it is not really about idle.
- k__ 4y agoLol, thanks. This comment was better than the docs, as usual.
- nuko-suke-dev 4y agoSorry for the confusion. >this is a convenience wrapper around “requestIdleCallback” That's right. I changed README. https://github.com/hiroki0525/idle-task#features https://github.com/hiroki0525/idle-task#features
- balls187 4y agoIn defense of the documentation, this is a convenience wrapper around “requestIdleCallback” which from MDN: “queues a function to be called during a browser's idle periods.” https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback https://developer.mozilla.org/en-US/docs/Web/API/Window/requ...