@promises/timer
v0.5.0
Published
Timer is package from Promises library
Downloads
264
Maintainers
Readme
@promises/timer
Timer is package from Promises library
Use
Module
$ npm install --save @promises/timer
import {
default as timer
} from '@promises/timer';
Browser
<script src="https://unpkg.com/@promises/timer/bundle.umd.min.js"></script>
let {
timer
} = P;
Examples
let promise: Promise<string> = Promise.resolve<string>('foo').delay(3000);
timer(promise, 1500, 'error: timeout').catch((error: string) => {
console.log(error); // error => 'error: timeout'
});
Wrapper
Module
$ npm install --save @promises/timer
import Promises from '@promises/core';
import '@promises/timer/add';
Or
import Promises from '@promises/timer/add';
Browser
<script src="https://unpkg.com/@promises/core/bundle.umd.min.js"></script>
<script src="https://unpkg.com/@promises/timer/add/bundle.umd.min.js"></script>
let {
Promises
} = P;
Examples
let promises: Promises<string> = Promises.resolve<string>('foo').delay(3000);
promises.timer(1500, 'error: timeout').catch((error: string) => {
console.log(error); // error => 'error: timeout'
});
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.