-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move WebContentsView to index.ts because it is exported fro…
…m CrossProcessExports
- Loading branch information
Showing
3 changed files
with
15 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { isVersionGreaterOrEqual } from './src/common/utils'; | ||
import * as Electron from 'electron'; | ||
|
||
const electronVersion = process.versions.electron; | ||
|
||
let WebContentsView_: typeof Electron.WebContentsView | undefined; | ||
|
||
if (isVersionGreaterOrEqual('29.0.0', electronVersion)) { | ||
WebContentsView_ = Electron.WebContentsView; // This will throw an error if it doesn't exist | ||
} else { | ||
throw new Error('WebContentsView is only available in Electron >= 29.0.0'); | ||
} | ||
|
||
export const WebContentsView = WebContentsView_; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1 @@ | ||
export { initialize, isInitialized, enable } from "./server"; | ||
|
||
import { isVersionGreaterOrEqual } from '../common/utils'; | ||
|
||
const electronVersion = process.versions.electron; | ||
|
||
let WebContentsView: typeof Electron.WebContentsView | undefined; | ||
|
||
if (isVersionGreaterOrEqual('29.0.0', electronVersion)) { | ||
WebContentsView = Electron.WebContentsView; | ||
} | ||
|
||
export { WebContentsView }; |