chore(docs): update

This commit is contained in:
草鞋没号 2022-01-06 09:21:29 +08:00
parent fc93d313fa
commit b6927955fa
2 changed files with 22 additions and 0 deletions

View File

@ -70,9 +70,20 @@ Once `dev` or `build` npm-script executed will be generate named `dist` folder.
contextBridge.exposeInMainWorld('ipcRenderer', ipcRenderer)
```
* **src/renderer/src/global.d.ts**
```typescript
// Defined on the window
interface Window {
fs: typeof import('fs')
ipcRenderer: import('electron').IpcRenderer
}
```
* **src/renderer/src/main.ts**
```typescript
// Use Electron, NodeJs API in Renderer-process
console.log('fs', window.fs)
console.log('ipcRenderer', window.ipcRenderer)
```

View File

@ -71,9 +71,20 @@
contextBridge.exposeInMainWorld('ipcRenderer', ipcRenderer)
```
* **src/renderer/src/global.d.ts**
```typescript
// Defined on the window
interface Window {
fs: typeof import('fs')
ipcRenderer: import('electron').IpcRenderer
}
```
* **src/renderer/main.ts**
```typescript
// Use Electron, NodeJs API in Renderer-process
console.log('fs', window.fs)
console.log('ipcRenderer', window.ipcRenderer)
```