| 
									
										
										
										
											2018-04-17 16:29:16 +09:00
										 |  |  | 'use strict' | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-17 16:46:32 +09:00
										 |  |  | const electron = require('electron') | 
					
						
							| 
									
										
										
										
											2018-04-17 16:29:16 +09:00
										 |  |  | const {EventEmitter} = require('events') | 
					
						
							|  |  |  | const {TopLevelWindow} = process.atomBinding('top_level_window') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Object.setPrototypeOf(TopLevelWindow.prototype, EventEmitter.prototype) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-17 16:46:32 +09:00
										 |  |  | TopLevelWindow.prototype._init = function () { | 
					
						
							|  |  |  |   // Avoid recursive require.
 | 
					
						
							|  |  |  |   const {app} = electron | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // Simulate the application menu on platforms other than macOS.
 | 
					
						
							|  |  |  |   if (process.platform !== 'darwin') { | 
					
						
							|  |  |  |     const menu = app.getApplicationMenu() | 
					
						
							|  |  |  |     if (menu) this.setMenu(menu) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-17 17:14:49 +09:00
										 |  |  | TopLevelWindow.getFocusedWindow = () => { | 
					
						
							|  |  |  |   return TopLevelWindow.getAllWindows().find((win) => win.isFocused()) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-17 16:29:16 +09:00
										 |  |  | module.exports = TopLevelWindow |