-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
29 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,4 +44,5 @@ doctor-storybook.log | |
public/app | ||
public/electron.js | ||
public/preload.js | ||
public/preload.cjs | ||
public/renderer.js |
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
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
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,20 +1,21 @@ | ||
import { contextBridge, ipcRenderer } from 'electron' | ||
/* eslint-disable @typescript-eslint/no-require-imports */ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
const { contextBridge, ipcRenderer } = require('electron') | ||
|
||
contextBridge.exposeInMainWorld('api', { | ||
send: (channel: string, data: any) => { | ||
// Whitelist channels | ||
const validChannels = ['toMain']; | ||
const validChannels = ['toMain'] | ||
if (validChannels.includes(channel)) { | ||
ipcRenderer.send(channel, data); | ||
ipcRenderer.send(channel, data) | ||
} | ||
}, | ||
receive: (channel: string, func: any) => { | ||
const validChannels = ['fromMain']; | ||
const validChannels = ['fromMain'] | ||
if (validChannels.includes(channel)) { | ||
// Deliberately strip event as it includes `sender` | ||
ipcRenderer.on(channel, (event, ...args) => func(...args)); | ||
ipcRenderer.on(channel, (event, ...args) => func(...args)) | ||
} | ||
}, | ||
yz: true, | ||
}); | ||
|
||
yz: true | ||
}) |
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,6 +1,6 @@ | ||
// This file is required by the index.html file and will | ||
// be executed in the renderer process for that window. | ||
// No Node.js APIs are available in this process because | ||
// `nodeIntegration` is turned off. Use `preload.js` to | ||
// `nodeIntegration` is turned off. Use `preload.cjs` to | ||
// selectively enable features needed in the rendering | ||
// process. |