mirror of
https://ark.sudovanilla.org/Korbs/electron-tabs.git
synced 2024-12-22 19:43:53 +00:00
Added event closing
This commit is contained in:
parent
a2a5ae7f3c
commit
cc838640a5
|
@ -148,6 +148,7 @@ The following events are available:
|
|||
* `tab.on("flash", (tab) => { ... });`
|
||||
* `tab.on("unflash", (tab) => { ... });`
|
||||
* `tab.on("close", (tab) => { ... });`
|
||||
* `tab.on("closing", (tab) => { ... });`
|
||||
|
||||
## Drag and drop support
|
||||
|
||||
|
@ -182,4 +183,4 @@ var tabGroup = new TabGroup({
|
|||
|
||||
## License
|
||||
|
||||
The MIT License (MIT) - Copyright (c) 2016 Thomas Brouard
|
||||
The MIT License (MIT) - Copyright (c) 2016 Thomas Brouard
|
||||
|
|
7
index.js
7
index.js
|
@ -225,6 +225,7 @@ class Tab extends EventEmitter {
|
|||
}
|
||||
|
||||
close (force) {
|
||||
this.emit("closing", this);
|
||||
if (this.isClosed || (!this.closable && !force)) return;
|
||||
this.isClosed = true;
|
||||
let tabGroup = this.tabGroup;
|
||||
|
@ -294,13 +295,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;
|
||||
|
@ -308,7 +309,7 @@ const TabPrivate = {
|
|||
this.webview.setAttribute(key, attrs[key]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.tabGroup.viewContainer.appendChild(this.webview);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue