Set default cancelId in JavaScript

This commit is contained in:
Cheng Zhao 2015-07-07 18:33:11 +08:00
parent b158427271
commit fb537d91fc
3 changed files with 14 additions and 19 deletions

View file

@ -92,7 +92,13 @@ module.exports =
options.message ?= ''
options.detail ?= ''
options.icon ?= null
options.cancelId ?= 0
unless options.cancelId?
options.cancelId = 0
for text, i in options.buttons
if text.toLowerCase() in ['cancel', 'no']
options.cancelId = i
break
binding.showMessageBox messageBoxType,
options.buttons,