main 부분
//async는 비동기로 요청 받고 event를 넘겨줘야하기 떄문에 넘겨줄때도 어떤 channel인지 명시해줘야함
ipcMain.on('asynchronous-message', (event, arg) => {
console.log("async " + arg) // "ping" 출력
event.reply('asynchronous-reply', 'pong')
})
//sync는 동기기때문에 받은 event의 리턴 밸류에 할당 해주면 됨.
ipcMain.on('synchronous-message', (event, arg) => {
console.log("sync " + arg) // "ping" 출력
event.returnValue = 'pong'
})
//메뉴 타이틀바를 숨기고 싶을때 사용
// //menu bar disable
// app.on('browser-window-created', function (e, window) {
// window.setMenu(null);
// });
//동기적으로 보낼때 데이터 받아오기
const a = ipcRenderer.sendSync('synchronous-message', 'ping')
console.log(a) // "pong"이 출력됩니다.
//비동기적함수 명시
// ipcRenderer.on('asynchronous-reply', (event, arg) => {
// console.log(arg) // "pong"이 출력됩니다.
// })
//보내고 응답 안 받을때
ipcRenderer.send('asynchronous-message', 'ping')