0.5.0 • Published 7 years ago
@promises/timeout v0.5.0
@promises/timeout
Timeout is package from Promises library
Use
Module
$ npm install --save @promises/timeoutimport {
default as timeout
} from '@promises/timeout';Browser
<script src="https://unpkg.com/@promises/timeout/bundle.umd.min.js"></script>let {
timeout
} = P;Examples
let promise: Promise<string> = timeout<string>((resolve, reject)=>{
resolve('foo')
}, 3000);
promise.then((result: string)=>{
console.log(result); // result => 'foo'
});Wrapper
Module
$ npm install --save @promises/timeoutimport Promises from '@promises/core';
import '@promises/timeout/add';Or
import Promises from '@promises/timeout/add';Browser
<script src="https://unpkg.com/@promises/core/bundle.umd.min.js"></script>
<script src="https://unpkg.com/@promises/timeout/add/bundle.umd.min.js"></script>let {
Promises
} = P;Examples
let promises: Promises<string> = Promises.timeout<string>((resolve, reject)=>{
resolve('foo')
}, 3000);
promises.then((result: string)=>{
console.log(result); // result => 'foo'
});Compatibility
These modules are written in typescript and available in ES5 and ES6 standard, the requirements are a global Promise (native or polyfill).
License
Copyright © 2017 Yisrael Eliav, Licensed under the MIT license.