myPromise
v1.0.0
Published
JavaScript library for asynchronize operations
Downloads
13
Readme
myPromise
myPromise is a fast, small, and feature-rich JavaScript library.
For information on how to get started and how to use myPromise, please see myPromise's test file. For source files and issues, please visit the myPromise repo.
Including myPromise
Below are some of the most common ways to include myPromise.
Browser
Script tag
Download source codes and refer the src or dist js file.
<script src="src/myPromise.js or (dist/myPromise.min.js)"></script>
AMD (Asynchronous Module Definition)
AMD is a module format built for the browser. For more information, we recommend require.js' documentation.
define(["myPromise"], function(myPromise) {
});
Node
To include myPromise in Node, first install with npm.
npm install myPromise
For myPromise to work in Node, an environment supported ECMAScript6 is required.
var myPromise=require("myPromise");
var p=new myPromise((resolve,reject)=>{setTimeout(()=>{resolve({data:1}),2000);}).then(result=>{});
//p.then(...).catch(err=>{}).then()....