From 88f40b1c79d3932efcc47ec59dadc100e99811bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=BCppers?= Date: Wed, 15 Feb 2017 15:23:52 +0100 Subject: [PATCH] Added 'webview-ready' event Added a 'webview-ready' event, which is fired, after the 'did-finish-load' event of the webview was fired. --- index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/index.js b/index.js index 8871dc2..165bd4e 100644 --- a/index.js +++ b/index.js @@ -294,6 +294,13 @@ const TabPrivate = { initWebview: function () { this.webview = document.createElement("webview"); + + const tabWebviewDidFinishLoadHandler = function (e) { + this.emit("webview-ready", this); + }; + + this.webview.addEventListener("did-finish-load", tabWebviewDidFinishLoadHandler.bind(this), false); + this.webview.classList.add(this.tabGroup.options.viewClass); if (this.webviewAttributes) { let attrs = this.webviewAttributes; @@ -301,6 +308,7 @@ const TabPrivate = { this.webview.setAttribute(key, attrs[key]); } } + this.tabGroup.viewContainer.appendChild(this.webview); } };