0.1.2 • Published 2 years ago

her-promise v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

npm node size

her-promise

This is a polyfill of the ES6/ES9/ES11/ES12 Promise.

Install

npm:

$ npm install --save her-promise

yarn:

$ yarn add her-promise

Browser

<script src="her-promise.js"></script>

Usage

Using in code

Using in browser

<script>
	new Promise((resolve, reject) => {
		reject();
	}).finally(() => {
		// ...
	});

	Promise.race([
		// ...
	]).then(() => {
		// ...
	});

	Promise.allSettled([
		// ...
	]).then(() => {
		// ...
	});

	Promise.any([
		// ...
	]).then(() => {
		// ...
	});
</script>

Using in es6 or typescript

// You can import in entry file at first
import 'her-promise';

new Promise((resolve, reject) => {
	reject();
}).finally(() => {
	// ...
});

Promise.race([
	// ...
]).then(() => {
	// ...
});

Promise.allSettled([
	// ...
]).then(() => {
	// ...
});

Promise.any([
	// ...
]).then(() => {
	// ...
});

License

MIT © Porky Ke