npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@addon-core/browser

v0.2.3

Published

TypeScript wrapper for Chrome extension APIs

Downloads

119

Readme

@addon-core/browser

A TypeScript promise-based wrapper for Chrome Extension APIs, supporting both Manifest V2 and V3 across Chrome, Opera, Edge, and other Chromium-based browsers.

npm version npm downloads License: MIT

Installation

# with your preferred package manager
npm i @addon-core/browser
# or
yarn add @addon-core/browser
# or
pnpm add @addon-core/browser

Supported browsers

  • Google Chrome (MV2 & MV3)
  • Microsoft Edge (Chromium)
  • Opera (Chromium) — plus sidebar helpers
  • Other Chromium-based browsers (e.g., Brave, Vivaldi, Arc, Yandex, Chromium) — expected to work; behavior aligns with Chrome.
  • Firefox — partial support via compatible helpers (e.g., sidebarAction, runtime.getBrowserInfo)
  • Apple Safari — limited WebExtensions support; many Chromium-specific APIs are not available, so some helpers won’t work.

Supported Chrome APIs

Why this package

  • Promise-based wrappers for callback-style Chrome APIs.
  • All event helpers return an unsubscribe function () => void.
  • Concise, consistent function names (easier to read and auto-complete).
  • Strong TypeScript types (based on @types/chrome) with explicit event parameter types.
  • Tree-shakable build (sideEffects: false) and small, focused utilities.
  • MV2/MV3 compatibility handled internally where applicable (e.g., Action, Tabs MV2 helpers, Sidebar cross-browser helpers).

Usage examples

  • setActionPopup (works in MV2 & MV3):
import { setActionPopup } from "@addon-core/browser";

await setActionPopup("popup.html");
// Optional per-tab usage (when you have a tab id):
// await setActionPopup("popup.html", someTabId);
  • getCurrentTab:
import { getCurrentTab } from "@addon-core/browser";

const tab = await getCurrentTab();
if (tab?.id) {
  console.log("Current tab id:", tab.id);
}
  • onTabUpdated (with unsubscribe):
import { onTabUpdated } from "@addon-core/browser";

const off = onTabUpdated((tabId, changeInfo, tab) => {
  if (changeInfo.status === "complete") {
    console.log("Tab finished loading:", tabId, tab.url);
  }
});

// Later, to stop listening:
off();

Not yet covered

These commonly used WebExtensions/Chrome Extension APIs are not wrapped here yet (Chrome OS–only APIs are intentionally omitted). If you’d like to contribute, please see CONTRIBUTING.md and open an issue/PR.

  • bookmarks
  • contentSettings
  • declarativeContent
  • declarativeNetRequest (and declarativeNetRequestFeedback)
  • desktopCapture
  • devtools.* (inspectedWindow, network, panels)
  • dns
  • fontSettings
  • identity
  • identityProvider
  • omnibox
  • pageCapture
  • platformKeys
  • power
  • privacy
  • proxy
  • search
  • sessions
  • system.cpu
  • system.memory
  • system.storage
  • tabGroups
  • topSites
  • tts
  • ttsEngine