https://github.com/sindresorhus/set-immediate-shim
Simple `setImmediate` shim
https://github.com/sindresorhus/set-immediate-shim
Last synced: 3 months ago
JSON representation
Simple `setImmediate` shim
- Host: GitHub
- URL: https://github.com/sindresorhus/set-immediate-shim
- Owner: sindresorhus
- License: mit
- Created: 2014-12-29T09:35:46.000Z (almost 11 years ago)
- Default Branch: main
- Last Pushed: 2024-03-12T05:26:55.000Z (over 1 year ago)
- Last Synced: 2025-04-09T15:05:49.333Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 28
- Watchers: 5
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license
- Security: .github/security.md
Awesome Lists containing this project
- awesome-nodejs-precise - set-immediate-shim - immediate-shim .svg?style=social&label=Star&maxAge=2592000?style=flat-square)]() | Simple <code>setImmediate()</code> ponyfill. | (Packages / Polyfills Node.js)
- awesome-nodejs-cn - set-immediate-shim - Simple `setImmediate()` ponyfill. (Number / Polyfills)
README
# set-immediate-shim
> Simple [`setImmediate`](https://developer.mozilla.org/en-US/docs/Web/API/Window/setImmediate) [ponyfill](https://ponyfill.com)
Note: This shim is [quite inefficient](https://github.com/sindresorhus/set-immediate-shim/issues/4).
## Install
```sh
npm install set-immediate-shim
```
## Usage
```js
import setImmediateShim from 'set-immediate-shim';
setImmediateShim(() => {
console.log('2');
});
console.log('1');
//=> 1
//=> 2
```
## Related
- [p-immediate](https://github.com/sindresorhus/p-immediate) - Returns a promise resolved in the next event loop - think `setImmediate()`