mirror of
https://github.com/atom/atom.git
synced 2026-02-17 10:01:25 -05:00
Move confirm into ApplicationDelegate
Signed-off-by: Max Brunsfeld <maxbrunsfeld@github.com>
This commit is contained in:
committed by
Max Brunsfeld
parent
3876deddf3
commit
20e07649d4
@@ -684,25 +684,8 @@ class AtomEnvironment extends Model
|
||||
# button names and the values are callbacks to invoke when clicked.
|
||||
#
|
||||
# Returns the chosen button index {Number} if the buttons option was an array.
|
||||
confirm: ({message, detailedMessage, buttons}={}) ->
|
||||
buttons ?= {}
|
||||
if _.isArray(buttons)
|
||||
buttonLabels = buttons
|
||||
else
|
||||
buttonLabels = Object.keys(buttons)
|
||||
|
||||
chosen = @applicationDelegate.showMessageDialog(
|
||||
type: 'info'
|
||||
message: message
|
||||
detail: detailedMessage
|
||||
buttons: buttonLabels
|
||||
)
|
||||
|
||||
if _.isArray(buttons)
|
||||
chosen
|
||||
else
|
||||
callback = buttons[buttonLabels[chosen]]
|
||||
callback?()
|
||||
confirm: (params={}) ->
|
||||
@applicationDelegate.confirm(params)
|
||||
|
||||
###
|
||||
Section: Managing the Dev Tools
|
||||
|
||||
Reference in New Issue
Block a user