is-background-v1.0.0
wxt-dev/wxtis-background-v1.0.0Feb 22, 2026by aklinker1
AI Summary
New official WXT package @wxt-dev/is-background v1.0.0 allows developers to check if the current JavaScript context is running in a background script or service worker. Works across all browsers and manifest versions.
Key Highlights
- New official @wxt-dev/is-background package
- Works in Chromium, Firefox, and Safari
- Supports both MV2 and MV3
New Features
- isBackground() function to detect background context
- Cross-browser compatibility (Chromium, Firefox, Safari)
- Support for MV2 and MV3
Full Release Notes
New official WXT package! Use `@wxt-dev/is-background` to check if the current JS context is a background script or service worker.
```ts
import { isBackground } from '@wxt-dev/is-background';
isBackground() // true or false
```
This is most useful to package developers whose library needs to know if it's running in the background or not, but you're welcome to use it directly in web extensions as well.
Tested and works in Chromium, Firefox, and Safari, both MV2 and MV3.