Call a callback-based function as ES6 Promise
npm install prominence> Call a callback-based function as ES6 Promise
```
npm install prominence
- prominenct(context: object): Prominenceprominence(context: object, methodName: string, [ args: any[] ]): Promise
-
ES6 Promise
`js
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
`js
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);
};
`
1. Fork it!
2. Create your feature branch: git checkout -b my-new-featuregit commit -am 'Add some feature'
3. Commit your changes: git push origin my-new-feature`
4. Push to the branch:
5. Submit a pull request :D