Add convenient accessors for Window API.
This commit is contained in:
		
					parent
					
						
							
								100c4a426b
							
						
					
				
			
			
				commit
				
					
						d508f711c6
					
				
			
		
					 1 changed files with 17 additions and 0 deletions
				
			
		|  | @ -1,3 +1,20 @@ | |||
| Window = process.atom_binding('window').Window | ||||
| 
 | ||||
| # Convient accessors. | ||||
| setupGetterAndSetter = (constructor, name, getter, setter) -> | ||||
|   constructor.prototype.__defineGetter__ name, -> | ||||
|     this[getter].apply(this, arguments) | ||||
|   constructor.prototype.__defineSetter__ name, -> | ||||
|     this[setter].apply(this, arguments) | ||||
| 
 | ||||
| setupGetterAndSetter Window, 'fullscreen', 'isFullscreen', 'setFullscreen' | ||||
| setupGetterAndSetter Window, 'size', 'getSize', 'setSize' | ||||
| setupGetterAndSetter Window, 'maximumSize', 'getMaximumSize', 'setMaximumSize' | ||||
| setupGetterAndSetter Window, 'minimumSize', 'getMinimumSize', 'setMinimumSize' | ||||
| setupGetterAndSetter Window, 'resizable', 'isResizable', 'setResizable' | ||||
| setupGetterAndSetter Window, 'alwaysOnTop', 'isAlwaysOnTop', 'setAlwaysOnTop' | ||||
| setupGetterAndSetter Window, 'position', 'getPosition', 'setPosition' | ||||
| setupGetterAndSetter Window, 'title', 'getTitle', 'setTitle' | ||||
| setupGetterAndSetter Window, 'kiosk', 'isKiosk', 'setKiosk' | ||||
| 
 | ||||
| module.exports = Window | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Cheng Zhao
				Cheng Zhao