Deprecate the page-title-set event
We have two names for the same event, page-title-updated wins.
This commit is contained in:
parent
c95117fb22
commit
e5974e44ed
6 changed files with 24 additions and 18 deletions
|
@ -520,9 +520,9 @@ void WebContents::DidNavigateMainFrame(
|
|||
void WebContents::TitleWasSet(content::NavigationEntry* entry,
|
||||
bool explicit_set) {
|
||||
if (entry)
|
||||
Emit("-page-title-set", entry->GetTitle(), explicit_set);
|
||||
Emit("-page-title-updated", entry->GetTitle(), explicit_set);
|
||||
else
|
||||
Emit("-page-title-set", "", explicit_set);
|
||||
Emit("-page-title-updated", "", explicit_set);
|
||||
}
|
||||
|
||||
void WebContents::DidUpdateFaviconURL(
|
||||
|
|
|
@ -32,7 +32,7 @@ BrowserWindow::_init = ->
|
|||
@emit 'crashed'
|
||||
|
||||
# Change window title to page title.
|
||||
@webContents.on 'page-title-set', (event, title, explicitSet) =>
|
||||
@webContents.on 'page-title-updated', (event, title, explicitSet) =>
|
||||
@emit 'page-title-updated', event, title
|
||||
@setTitle title unless event.defaultPrevented
|
||||
|
||||
|
|
|
@ -76,13 +76,15 @@ wrapWebContents = (webContents) ->
|
|||
# until next tick.
|
||||
setImmediate => @emit 'did-fail-load', args...
|
||||
|
||||
# Delays the page-title-set event to next tick.
|
||||
webContents.on '-page-title-set', (args...) ->
|
||||
setImmediate => @emit 'page-title-set', args...
|
||||
# Delays the page-title-updated event to next tick.
|
||||
webContents.on '-page-title-updated', (args...) ->
|
||||
setImmediate => @emit 'page-title-updated', args...
|
||||
|
||||
# Deprecated.
|
||||
deprecate.rename webContents, 'loadUrl', 'loadURL'
|
||||
deprecate.rename webContents, 'getUrl', 'getURL'
|
||||
deprecate.event webContents, 'page-title-set', 'page-title-updated', (args...) ->
|
||||
@emit 'page-title-set', args...
|
||||
|
||||
webContents.printToPDF = (options, callback) ->
|
||||
printingSetting =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue