0.0.6 • Published 6 years ago

browser-interface v0.0.6

Weekly downloads
3
License
ISC
Repository
-
Last release
6 years ago

Browser Interface

Important: this package is in early development. It is not ready for production! Do not use it.

WebExtensions allows people to develop browser extensions for multiple browsers. Unfortunately, the methods and syntaxes are not exactly the same in every browser, so that requires some tweaking. This package aims to solve this problem by providing a single syntax for all browsers. It uses the methods and syntax described on the MDN website, and it is compatible with Google Chrome and Mozilla Firefox. Not tested yet in Microsoft Edge.

Installation

Using npm:

npm install --save browser-interface

In Node.js:

import BrowserInterface from "browser-interface";

// Create a driver and pass it the window Object
const driver = new BrowserInterface(window);

// Use it in all browsers
driver.webRequest.onBeforeRequest.addListener(
  req => {
    console.log(req);
  },
  { urls: ["<all_urls>"] }
);

API coverage

This project is still in progress. Here are the different WebExtensions APIs supported at this time.

webRequest

PropertyStatusChromeFirefoxEdge
onBeforeRedirectComplete:grey_question::grey_question::grey_question:
onBeforeRequestComplete:heavy_check_mark::heavy_check_mark::grey_question:
onBeforeSendHeadersComplete:heavy_check_mark::heavy_check_mark::grey_question:
onCompletedComplete:heavy_check_mark::heavy_check_mark::grey_question:
onErrorOccurredComplete:grey_question::grey_question::grey_question:
onHeadersReceivedComplete:heavy_check_mark::heavy_check_mark::grey_question:
onResponseStartedComplete:heavy_check_mark::heavy_check_mark::grey_question:
onSendHeadersComplete:heavy_check_mark::heavy_check_mark::grey_question:

tabs

PropertyStatusChromeFirefoxEdge
onActivatedComplete:heavy_check_mark::heavy_check_mark::grey_question:
onAttachedComplete:heavy_check_mark::heavy_check_mark::grey_question:
onCreatedComplete:heavy_check_mark::heavy_check_mark::grey_question:
onDetachedComplete:heavy_check_mark::heavy_check_mark::grey_question:
onHighlightedComplete:heavy_check_mark::heavy_check_mark::heavy_multiplication_x:
onMovedComplete:heavy_check_mark::heavy_check_mark::heavy_multiplication_x:
onRemovedComplete:heavy_check_mark::heavy_check_mark::grey_question:
onUpdatedComplete:heavy_check_mark::heavy_check_mark::grey_question:
sendMessageComplete:grey_question::grey_question::grey_question:
queryComplete:heavy_check_mark::grey_question::grey_question:
createComplete:grey_question::grey_question::grey_question:
removeComplete:grey_question::grey_question::grey_question:
updateComplete:grey_question::grey_question::grey_question:
getComplete:grey_question::grey_question::grey_question:
getCurrentComplete:grey_question::grey_question::grey_question:

storage

PropertyStatusChromeFirefoxEdge
syncComplete:heavy_check_mark::grey_question::grey_question:
localComplete:heavy_check_mark::grey_question::grey_question:

browserAction

PropertyStatusChromeFirefoxEdge
enableComplete:grey_question::grey_question::grey_question:
disableComplete:grey_question::grey_question::grey_question:
setIconComplete:heavy_check_mark::grey_question::grey_question:
setPopupComplete:grey_question::grey_question::grey_question:
setTitleComplete:grey_question::grey_question::grey_question:

runtime

PropertyStatusChromeFirefoxEdge
getBackgroundPageComplete:heavy_check_mark::grey_question::grey_question:
onMessageComplete:heavy_check_mark::grey_question::grey_question:
sendMessageComplete:heavy_check_mark::grey_question::grey_question: