github wxt-dev/wxt is-background-v1.0.0
@wxt-dev/is-background v1.0.0

latest releases: wxt-v0.20.18, analytics-v0.5.4, analytics-v0.5.3...
6 hours ago

New official WXT package! Use @wxt-dev/is-background to check if the current JS context is a background script or service worker.

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.

Don't miss a new wxt release

NewReleases is sending notifications on new releases.