
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600× Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
browser-namespace
Advanced tools
Cross-browser support for the `browser` namespace in browser extensions. Fully typed.
Cross-browser support for the browser
namespace in browser extensions. Fully typed.
npm i browser-namespace
import { browser } from "browser-namespace";
await browser.storage.local.set(data); // for example
Some browsers use the browser
API namespace, while others use chrome
. This package unifies both and provides a fully typed API.
It essentially does this:
export const browser: BrowserAPI = window.browser ?? window.chrome;
The types come from @types/webextension-polyfill
.
In contrast with webextension-polyfill, which does a lot more, this package limits itself to providing a convenient, unified and fully typed namespace.
Support for specific features still depends on the browser and version. For this reason, types might be inaccurate. Performing feature detection is recommended.
If you need any Chrome-specific APIs, you can use the chrome
namespace:
import { chrome } from "browser-namespace";
await chrome.debugger.sendCommand(/* ... */); // for example
The types are derived from @types/chrome
. The reason these types are copied instead of imported is because they declare chrome
as a global variable, which might be unwanted. The version in this repo is patched to fix that.
Again, support for specific features depends on the browser and version.
The types for both browser and Chrome API namespaces can be imported directly.
There are types for the APIs themselves (corresponding to the types of the browser
and chrome
runtime objects):
import type { BrowserAPI, ChromeAPI } from "browser-namespace";
Additionally, the TypeScript namespace declarations are also exported:
import type { Browser, Chrome } from "browser-namespace";
These are useful to access certain types. Some examples:
Browser.Runtime.Port
, returned from browser.runtime.connect
.Chrome.debugger.Debuggee
, passed to chrome.debugger.attach
.FAQs
Cross-browser support for the `browser` namespace in browser extensions. Fully typed.
The npm package browser-namespace receives a total of 667 weekly downloads. As such, browser-namespace popularity was classified as not popular.
We found that browser-namespace demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.