mirror of
https://ark.sudovanilla.org/Korbs/electron-tabs.git
synced 2024-12-23 03:53:53 +00:00
Merge pull request #13 from bkueppers/master
Added "webview-ready" Event
This commit is contained in:
commit
e2b03786b1
|
@ -139,6 +139,7 @@ The following events are available:
|
||||||
* `tabGroup.on("tab-added", (tab, tabGroup) => { ... });`
|
* `tabGroup.on("tab-added", (tab, tabGroup) => { ... });`
|
||||||
* `tabGroup.on("tab-removed", (tab, tabGroup) => { ... });`
|
* `tabGroup.on("tab-removed", (tab, tabGroup) => { ... });`
|
||||||
* `tabGroup.on("tab-active", (tab, tabGroup) => { ... });`
|
* `tabGroup.on("tab-active", (tab, tabGroup) => { ... });`
|
||||||
|
* `tab.on("webview-ready", (title, tab) => { ... });`
|
||||||
* `tab.on("title-changed", (title, tab) => { ... });`
|
* `tab.on("title-changed", (title, tab) => { ... });`
|
||||||
* `tab.on("icon-changed", (icon, tab) => { ... });`
|
* `tab.on("icon-changed", (icon, tab) => { ... });`
|
||||||
* `tab.on("active", (tab) => { ... });`
|
* `tab.on("active", (tab) => { ... });`
|
||||||
|
|
8
index.js
8
index.js
|
@ -294,6 +294,13 @@ const TabPrivate = {
|
||||||
|
|
||||||
initWebview: function () {
|
initWebview: function () {
|
||||||
this.webview = document.createElement("webview");
|
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);
|
this.webview.classList.add(this.tabGroup.options.viewClass);
|
||||||
if (this.webviewAttributes) {
|
if (this.webviewAttributes) {
|
||||||
let attrs = this.webviewAttributes;
|
let attrs = this.webviewAttributes;
|
||||||
|
@ -301,6 +308,7 @@ const TabPrivate = {
|
||||||
this.webview.setAttribute(key, attrs[key]);
|
this.webview.setAttribute(key, attrs[key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tabGroup.viewContainer.appendChild(this.webview);
|
this.tabGroup.viewContainer.appendChild(this.webview);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue