setImmediate polyfill for the browser and node. This is an alternative to setTimeout(fn, 0)
, which behaves like setTimeout(fn, 4)
. setAsap will execute immediately. It has unmatched performance and is extremely lightweight.
npm install setasap --save
setAsap(function() {
// do something async
});
Currently, there is no way to cancel setAsap. The code base is much smaller without it.