@promises/from-callback
v0.5.0
Published
From Callback is package from Promises library
Downloads
20
Maintainers
Readme
@promises/from-callback
From Callback is package from Promises library
Use
Module
$ npm install --save @promises/from-callback
import {
default as fromCallback
} from '@promises/from-callback';
Browser
<script src="https://unpkg.com/@promises/from-callback/bundle.umd.min.js"></script>
let {
fromCallback
} = P;
Examples
fromCallback<string[]>((callback) => {
fs.readdir(process.cwd(), callback);
}).then((result: string[]) => {
console.log(result);
});
Wrapper
Module
$ npm install --save @promises/from-callback
import Promises from '@promises/core';
import '@promises/from-callback/add';
Or
import Promises from '@promises/from-callback/add';
Browser
<script src="https://unpkg.com/@promises/core/bundle.umd.min.js"></script>
<script src="https://unpkg.com/@promises/from-callback/add/bundle.umd.min.js"></script>
let {
Promises
} = P;
Examples
let readDir = fs.readdir.bind(null, process.cwd());
Promises.fromCallback<string[]>(readDir).then((result: string[]) => {
console.log(result);
});
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.