JSPM

prominence

0.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 16
  • Score
    100M100P100Q41874F

Call a callback-based function as ES6 Promise

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

Build Status NPM Version License

Call a callback-based function as ES6 Promise

Installation

NPM

npm install prominence

API

  • prominenct(context: object): Prominence
  • prominence(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

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT