Merge pull request #18 from rriclet/feature/closing

Feature/closing
This commit is contained in:
Thomas Brouard 2017-04-05 09:45:27 +02:00 committed by GitHub
commit be552d4266
2 changed files with 3 additions and 1 deletions

View file

@ -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

View file

@ -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;