Package Exports
- prominence
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (prominence) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
prominence
Call a callback-based function as ES6 Promise
Installation
NPM
npm install prominenceAPI
prominenct(context: object): Prominenceprominence(context: object, methodName: string, [ args: any[] ]): Promise<any>
Examples
ES6 Promise
import fs from "fs";
import prominence from "prominence";
// use Prominence proxy
prominence(fs).readFile(filepath, "utf-8").then((text) => {
console.log(text);
}).catch(console.error.bind(console));
// not use a proxy
prominence(fs, "readFile", [ filepath, "utf-8" ]).then((text) => {
console.log(text);
}).catch(console.error.bind(console));ES7 Async/Await
import fs from "fs";
import prominence from "prominence";
// use Prominence Proxy
async (filepath) => {
let text = await prominence(fs).readFile(filepath, "utf-8");
console.log(text);
};
// not use a proxy
async (filepath) => {
let text = await prominence(fs, "readFile", [ filepath, "utf-8" ]);
console.log(text);
};Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-new-feature - Submit a pull request :D