add globalThis.ContextType
This commit is contained in:
@@ -40,7 +40,8 @@
|
||||
],
|
||||
"globals": {
|
||||
"GM": true,
|
||||
"unsafeWindow": true
|
||||
"unsafeWindow": true,
|
||||
"globalThis": true
|
||||
}
|
||||
},
|
||||
"browserslist": {
|
||||
|
||||
@@ -16,6 +16,8 @@ import { sendTabMsg } from "./libs/msg";
|
||||
import { trySyncAllSubRules } from "./libs/subRules";
|
||||
import { tryClearCaches } from "./libs";
|
||||
|
||||
globalThis.ContextType = "BACKGROUND";
|
||||
|
||||
/**
|
||||
* 插件安装
|
||||
*/
|
||||
|
||||
@@ -13,3 +13,5 @@ function _browser() {
|
||||
}
|
||||
|
||||
export const browser = _browser();
|
||||
|
||||
export const isBg = () => globalThis?.ContextType === "BACKGROUND";
|
||||
|
||||
Reference in New Issue
Block a user