@promises/sleep
TypeScript icon, indicating that this package has built-in type declarations

0.5.0 • Public • Published

@promises/sleep

Source Code Version MIT License Bundle Size

Sleep is package from Promises library

Use

Module

$ npm install --save @promises/sleep
import {
 default as sleep
} from '@promises/sleep';

Browser

<script src="https://unpkg.com/@promises/sleep/bundle.umd.min.js"></script>
let {
 sleep
} = P;

Examples

 let promise: Promise<string> = Promise.resolve<string>('foo');

 sleep(promise, 3000).then((result: string) => {
   console.log(result); // result => 'foo'
 });

Functional programming

Module

$ npm install --save @promises/sleep
import {
 __,
 default as sleep
} from '@promises/sleep/fp';

Browser

<script src="https://unpkg.com/@promises/sleep/fp/bundle.umd.min.js"></script>
let {
 __,
 sleep
} = PF;

Examples

 let promise: Promise<string> = Promise.resolve<string>('foo');

 sleep(3000, promise).then((result: string) => {
   console.log(result); // result => 'foo'
 });

Wrapper

Module

$ npm install --save @promises/sleep
import Promises from '@promises/core';
import '@promises/sleep/add';

Or

import Promises from '@promises/sleep/add';

Browser

<script src="https://unpkg.com/@promises/core/bundle.umd.min.js"></script>
<script src="https://unpkg.com/@promises/sleep/add/bundle.umd.min.js"></script>
let {
 Promises
} = P;

Examples

 let promises: Promises<string> = Promises.resolve<string>('foo');
 promises.sleep(3000).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.

Package Sidebar

Install

npm i @promises/sleep

Weekly Downloads

1

Version

0.5.0

License

MIT

Unpacked Size

53.8 kB

Total Files

39

Last publish

Collaborators

  • yisraelx