Skip to content

slikts/promiseproxy-chrome

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

view on npm

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

About

Lightweight Proxy-based promisified Chrome API wrapper

Resources

License

Stars

Watchers

Forks

Packages

No packages published