From: Cheng Zhao Date: Tue, 29 Apr 2014 07:21:22 +0000 (+0800) Subject: Move "restart()" API to webContents. X-Git-Tag: v0.12.1~4 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=19698fc739da410bcc5b528f8a8304f7072b338a;p=electron.git Move "restart()" API to webContents. --- diff --git a/atom/browser/api/lib/browser-window.coffee b/atom/browser/api/lib/browser-window.coffee index 9a1f26a5..7413ff8b 100644 --- a/atom/browser/api/lib/browser-window.coffee +++ b/atom/browser/api/lib/browser-window.coffee @@ -51,9 +51,6 @@ BrowserWindow::getWebContents = -> BrowserWindow::getDevToolsWebContents = -> wrapWebContents @_getDevToolsWebContents() -BrowserWindow::restart = -> - @loadUrl(@getUrl()) - BrowserWindow::setMenu = (menu) -> if process.platform is 'darwin' throw new Error('BrowserWindow.setMenu is not available on OS X') @@ -84,6 +81,7 @@ BrowserWindow::loadUrl = -> @webContents.loadUrl.apply @webContents, arguments BrowserWindow::send = -> @webContents.send.apply @webContents, arguments # Be compatible with old API. +BrowserWindow::restart = -> @webContents.restart() BrowserWindow::getUrl = -> @webContents.getUrl() BrowserWindow::reload = -> @webContents.reload() BrowserWindow::reloadIgnoringCache = -> @webContents.reloadIgnoringCache() diff --git a/atom/browser/api/lib/web-contents.coffee b/atom/browser/api/lib/web-contents.coffee index 5e721233..822f3462 100644 --- a/atom/browser/api/lib/web-contents.coffee +++ b/atom/browser/api/lib/web-contents.coffee @@ -11,6 +11,10 @@ module.exports.wrap = (webContents) -> webContents.send = (args...) -> @_send 'ATOM_INTERNAL_MESSAGE', [args...] + # WebContents::restart() + # Restart the renderer process. + webContents.restart = -> @loadUrl @getUrl() + # The processId and routingId and identify a webContents. webContents.getId = -> "#{@getProcessId()}-#{@getRoutingId()}" webContents.equal = (other) -> @getId() is other.getId()