Only set the title listener after the webview finishes loading

This commit is contained in:
Jia Hao 2015-07-06 11:45:55 +08:00
parent 4ddf10a108
commit d7859160eb
1 changed files with 4 additions and 2 deletions

View File

@ -25,8 +25,10 @@ ipc.on('params', function(message) {
// We check for desktop notifications by listening to a title change in the webview
// Not elegant, but it will have to do
if (appArgs.badge) {
webView.addEventListener('page-title-set', function(event) {
ipc.send('notification-message', 'TITLE_CHANGED');
webView.addEventListener('did-finish-load', function(e) {
webView.addEventListener('page-title-set', function(event) {
ipc.send('notification-message', 'TITLE_CHANGED');
});
});
}