-
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
18 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,17 @@ | ||
import * as Electron from 'electron'; | ||
import { isVersionGreaterOrEqual } from './src/common/utils'; | ||
|
||
const electronVersion = process.versions.electron; | ||
|
||
// Check if WebContentsView exists and if the version is >= 29.0.0 | ||
let WebContentsView_: any; // Use 'any' for dynamic checking | ||
|
||
if (isVersionGreaterOrEqual('29.0.0', electronVersion) && 'WebContentsView' in Electron) { | ||
WebContentsView_ = Electron.WebContentsView; // Assign if it exists | ||
} else { | ||
console.warn("WebContentsView is not available in this version of Electron."); | ||
WebContentsView_ = undefined; // Explicitly set to undefined if not available | ||
} | ||
|
||
// Export the WebContentsView for use in other parts of your application | ||
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 }; |