[electron x react] react 呼叫 electron api 與 node api 的方法
呼叫 electron api
參考:https://medium.freecodecamp.org/building-an-electron-application-with-create-react-app-97945861647c
-
呼叫 node api
※以"os"舉例
參考:https://medium.freecodecamp.org/building-an-electron-application-with-create-react-app-97945861647c
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
const electron = window.require('electron'); | |
const fs = electron.remote.require('fs'); | |
const ipcRenderer = electron.ipcRenderer; |
呼叫 node api
※以"os"舉例
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
const os = window.require('os'); |
留言
張貼留言