Use string instead of integer to represent dialog's types.
This commit is contained in:
		
					parent
					
						
							
								f3a6037d00
							
						
					
				
			
			
				commit
				
					
						7e11743735
					
				
			
		
					 1 changed files with 5 additions and 7 deletions
				
			
		|  | @ -53,6 +53,8 @@ selectFileWrap = (window, options, callback, type, title) -> | ||||||
|                         options.defaultExtension, |                         options.defaultExtension, | ||||||
|                         callbackId |                         callbackId | ||||||
| 
 | 
 | ||||||
|  | messageBoxTypes = ['none', 'info', 'warning'] | ||||||
|  | 
 | ||||||
| module.exports = | module.exports = | ||||||
|   openFolder: (args...) -> |   openFolder: (args...) -> | ||||||
|     selectFileWrap args..., 1, 'Open Folder' |     selectFileWrap args..., 1, 'Open Folder' | ||||||
|  | @ -70,8 +72,9 @@ module.exports = | ||||||
|     throw new TypeError('Need Window object') unless window.constructor is BrowserWindow |     throw new TypeError('Need Window object') unless window.constructor is BrowserWindow | ||||||
| 
 | 
 | ||||||
|     options = {} unless options? |     options = {} unless options? | ||||||
|     options.type = options.type ? module.exports.MESSAGE_BOX_NONE |     options.type = options.type ? 'none' | ||||||
|     throw new TypeError('Invalid message box type') unless 0 <= options.type <= 2 |     options.type = messageBoxTypes.indexOf options.type | ||||||
|  |     throw new TypeError('Invalid message box type') unless options.type > -1 | ||||||
| 
 | 
 | ||||||
|     throw new TypeError('Buttons need to be array') unless Array.isArray options.buttons |     throw new TypeError('Buttons need to be array') unless Array.isArray options.buttons | ||||||
| 
 | 
 | ||||||
|  | @ -83,8 +86,3 @@ module.exports = | ||||||
|                            String(options.title), |                            String(options.title), | ||||||
|                            String(options.message), |                            String(options.message), | ||||||
|                            String(options.detail) |                            String(options.detail) | ||||||
| 
 |  | ||||||
|   # Message box types: |  | ||||||
|   MESSAGE_BOX_NONE: 0 |  | ||||||
|   MESSAGE_BOX_INFORMATION: 1 |  | ||||||
|   MESSAGE_BOX_WARNING: 2 |  | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Cheng Zhao
				Cheng Zhao