Get started with setImmediate CDN

MIT licensed

`setImmediate` schedules a Node.js callback for next poll cycle post current finish.

Tags:
  • cross-browser
  • api
  • clearImmediate
  • setImmediate

Stable version

Copied!

How to start using setImmediate CDN


// Include the setImmediate library
const setImmediate = (function() {
  return window.setImmediate || function(callback) {
    window.setTimeout(callback, 0);
  };
})();

// Use setImmediate
function printMessageAfterDelay() {
  console.log('Hello, I will be printed after the current task is finished.');
}

// Current task
console.log('Hello, I will be printed immediately.');
setImmediate(printMessageAfterDelay);
Copied!
Copied!
Copied!

All versions