mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-19 20:07:06 +08:00
add samples/node-api.ts
This commit is contained in:
parent
b2b3a5d63c
commit
f2881a3137
14
src/sample/node-api.ts
Normal file
14
src/sample/node-api.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { lstat } from 'fs/promises'
|
||||||
|
import { cwd } from 'process'
|
||||||
|
import { ipcRenderer } from 'electron'
|
||||||
|
|
||||||
|
// Usage of ipcRenderer.on
|
||||||
|
ipcRenderer.on('main-process-message', (_event, ...args) => {
|
||||||
|
console.log('[Receive Main-process message]:', ...args)
|
||||||
|
})
|
||||||
|
|
||||||
|
lstat(cwd()).then(stats => {
|
||||||
|
console.log('[fs.lstat]', stats)
|
||||||
|
}).catch(err => {
|
||||||
|
console.error(err)
|
||||||
|
})
|
Loading…
x
Reference in New Issue
Block a user