Promise-based chrome api.
var thenChrome = require('then-chrome');
// get tabs list
thenChrome.tabs.query({currentWindow: true})
.then(console.log); // tabs list
// get all cookies by name
thenChrome.cookies.getAll({name: 'cookieName'})
.then(console.log); // cookie list
// detect language by tab
thenChrome.tabs.detectLanguage(10)
.then(console.log); // en
.catch(console.warn); // catch chrome.runtime.lastError value
Sync methods are wrapped too
var thenChrome = require('then-chrome');
thenChrome.i18n.getMessage('title')
.then(console.log); // 'extension title'
There is native Promise inside then-chrome by default, but you can use every Thenable lib, compatible with Promises/A+ standart.
var Q = require('q');
var BlueBird = require('bluebird');
var create = require('then-chrome/out/api');
var thenChromeQ = create(Q.Promise); // then-chrome with Q promise inside
var thenChromeBB = create(BlueBird); // then-chrome with bluebird promise inside
npm install then-chrome
or
git clone https://github.com/acvetkov/then-chrome.git
cd then-chrome
npm install
npm run build
npm test
- chrome.alarms
- chrome.bookmarks
- chrome.browserAction
- chrome.browsingData
- chrome.commands
- chrome.contextMenus
- chrome.cookies
- chrome.debugger
- chrome.desktopCapture
- chrome.devtools.inspectedWindow
- chrome.devtools.network
- chrome.devtools.panels
- chrome.dial (undocumented API for communication with DIAL-capable devices)
- chrome.downloads
- chrome.extension
- chrome.fontSettings
- chrome.gcm
- chrome.history
- chrome.i18n
- chrome.identity
- chrome.idle
- chrome.instanceID
- chrome.management
- chrome.notifications
- chrome.omnibox
- chrome.pageAction
- chrome.pageCapture
- chrome.permissions
- chrome.privacy
- chrome.proxy
- chrome.runtime
- chrome.sessions
- chrome.storage
- chrome.system.cpu
- chrome.system.memory
- chrome.system.storage
- chrome.tabCapture
- chrome.tabs
- chrome.topSites
- chrome.tts
- chrome.webNavigation
- chrome.webRequest
- chrome.windows
Awesome Browser Extensions And Apps - a curated list of awesome resources for building browser extensions and apps.