Skip to content

Commit

Permalink
Separate support for tab capture from chromium
Browse files Browse the repository at this point in the history
  • Loading branch information
vantezzen committed Aug 10, 2022
1 parent c42a62d commit 452d4c4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/background/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { isChromium } from "~shared/platform"
import { supportsTabCapture } from "~shared/platform"

import BackgroundManager from "./BackgroundManager"
import setupKeyboardShortcutsListener from "./keyboardShortcuts"

if (isChromium) {
if (supportsTabCapture) {
new BackgroundManager()
}
setupKeyboardShortcutsListener()
Expand Down
4 changes: 2 additions & 2 deletions src/contents/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import browser from "webextension-polyfill"

import getState from "~shared/state"

import { isChromium } from "../shared/platform"
import { supportsTabCapture } from "../shared/platform"
import setupFirefoxContent from "./lib/browserSetup/firefox"
import setupBrowserContent from "./lib/browserSetup/shared"
import Bar from "./lib/command-bar/Bar"
Expand All @@ -24,7 +24,7 @@ export const config: PlasmoContentScript = {
const state = getState(StateEnvironment.Content)

setupBrowserContent(state)
if (!isChromium) {
if (!supportsTabCapture) {
setupFirefoxContent(state)
}

Expand Down
3 changes: 2 additions & 1 deletion src/shared/platform.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const isChromium = navigator.userAgent.includes('Chrome');
export const isChromium = navigator.userAgent.includes("Chrome")
export const supportsTabCapture = isChromium

0 comments on commit 452d4c4

Please sign in to comment.