promiseproxy-chrome
v1.0.3
Published
Extremely lightweight Proxy-based promisified Chrome API wrapper
Downloads
12
Readme
Promisified Chrome API
PromiseProxy with a schema for the Chrome JavaScript APIs.
Requirements
- Node.js 6+, Chrome or other ES2015
Proxy
object supporting environment
Installation
npm install promiseproxy-chrome
Usage
// Promisify the global chrome object
const _chrome = require('promiseproxy-chrome')(chrome)
// Callback methods return promises when the callback parameter is null or undefined
_chrome.tabs.query(info).then(callback)
Build
npm run build
Updating api.json
Use in console on each page of the Chrome API docs:
localStorage.methods = JSON.stringify(Object.assign(JSON.parse(localStorage.methods), { [location.pathname]: $$('#toc .pln').filter(x => /callback/i.test(x.textContent)).map(x => x.closest('.prettyprint').textContent) }))
Copy contents of localStorage.methods
to api.json
.
Test
npm install --only=dev
npm run test
License
MIT