Skip to content

Commit

Permalink
feat: move the extRuntime into getExtRuntime (#881)
Browse files Browse the repository at this point in the history
refactor: remove the extRuntime into getExtRuntime

Signed-off-by: Crazy Urus <[email protected]>
  • Loading branch information
crazyurus authored Jan 30, 2024
1 parent d40dcfd commit 8536cf2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions api/messaging/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { PlasmoMessaging } from "./index"

// TODO: Move this to a broader utils package later on
const extRuntime = (globalThis.browser?.runtime ||
globalThis.chrome?.runtime) as typeof chrome.runtime

const extTabs = (globalThis.browser?.tabs ||
globalThis.chrome?.tabs) as typeof chrome.tabs

export const getExtRuntime = () => {
// TODO: Move this to a broader utils package later on
const extRuntime = (globalThis.browser?.runtime ||
globalThis.chrome?.runtime) as typeof chrome.runtime

if (!extRuntime) {
throw new Error("Extension runtime is not available")
}
Expand Down

0 comments on commit 8536cf2

Please sign in to comment.