From d7859160ebaa1733a76278f7c54e4309e34f35c0 Mon Sep 17 00:00:00 2001 From: Jia Hao Date: Mon, 6 Jul 2015 11:45:55 +0800 Subject: [PATCH] Only set the title listener after the webview finishes loading --- app/assets/js/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/assets/js/index.js b/app/assets/js/index.js index ba0b42a..5ba88bf 100644 --- a/app/assets/js/index.js +++ b/app/assets/js/index.js @@ -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'); + }); }); }