Use the new style remote module in Electron

This commit is contained in:
Cheng Zhao 2015-11-13 22:22:25 +08:00
parent b925ac0056
commit 94e24abb99
5 changed files with 7 additions and 14 deletions

View file

@ -67,19 +67,17 @@ window.open = (url, frameName='', features='') ->
# Use the dialog API to implement alert().
window.alert = (message, title='') ->
dialog = remote.require 'dialog'
buttons = ['OK']
message = message.toString()
dialog.showMessageBox remote.getCurrentWindow(), {message, title, buttons}
remote.dialog.showMessageBox remote.getCurrentWindow(), {message, title, buttons}
# Alert should always return undefined.
return
# And the confirm().
window.confirm = (message, title='') ->
dialog = remote.require 'dialog'
buttons = ['OK', 'Cancel']
cancelId = 1
not dialog.showMessageBox remote.getCurrentWindow(), {message, title, buttons, cancelId}
not remote.dialog.showMessageBox remote.getCurrentWindow(), {message, title, buttons, cancelId}
# But we do not support prompt().
window.prompt = ->