| 
									
										
										
										
											2019-10-10 09:49:07 -04:00
										 |  |  | const { app, BrowserWindow, ipcMain } = require('electron') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | let mainWindow = null | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function createWindow () { | 
					
						
							|  |  |  |   const windowOptions = { | 
					
						
							|  |  |  |     width: 600, | 
					
						
							|  |  |  |     height: 400, | 
					
						
							|  |  |  |     title: 'Asynchronous messages', | 
					
						
							|  |  |  |     webPreferences: { | 
					
						
							|  |  |  |       nodeIntegration: true | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   mainWindow = new BrowserWindow(windowOptions) | 
					
						
							|  |  |  |   mainWindow.loadFile('index.html') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   mainWindow.on('closed', () => { | 
					
						
							|  |  |  |     mainWindow = null | 
					
						
							|  |  |  |   }) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-03 16:43:22 -06:00
										 |  |  | app.whenReady().then(() => { | 
					
						
							| 
									
										
										
										
											2019-10-10 09:49:07 -04:00
										 |  |  |   createWindow() | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ipcMain.on('asynchronous-message', (event, arg) => { | 
					
						
							|  |  |  |   event.sender.send('asynchronous-reply', 'pong') | 
					
						
							|  |  |  | }) |