mirror of
https://ark.sudovanilla.org/Korbs/electron-tabs.git
synced 2024-12-23 03:53:53 +00:00
Make consistant API for flash and show
This commit is contained in:
parent
e7f8111e03
commit
f6664f50d3
20
index.js
20
index.js
|
@ -182,30 +182,38 @@ class Tab extends EventEmitter {
|
|||
return this;
|
||||
}
|
||||
|
||||
show () {
|
||||
show (flag) {
|
||||
if (this.isClosed) return;
|
||||
if (flag !== false) {
|
||||
this.tab.classList.add("visible");
|
||||
this.emit("visible", this);
|
||||
} else {
|
||||
this.tab.classList.remove("visible");
|
||||
this.emit("hidden", this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
hide () {
|
||||
if (this.isClosed) return;
|
||||
this.tab.classList.remove("visible");
|
||||
return this;
|
||||
return this.show(false);
|
||||
}
|
||||
|
||||
flash (flag) {
|
||||
if (this.isClosed) return;
|
||||
if (flag !== false) {
|
||||
this.tab.classList.add("flash");
|
||||
this.emit("flash-start", this);
|
||||
this.emit("flash", this);
|
||||
} else {
|
||||
this.tab.classList.remove("flash");
|
||||
this.emit("flash-end", this);
|
||||
this.emit("unflash", this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
unflash () {
|
||||
return this.flash(false);
|
||||
}
|
||||
|
||||
close (force) {
|
||||
if (this.isClosed || (!this.closable && !force)) return;
|
||||
this.isClosed = true;
|
||||
|
|
Loading…
Reference in a new issue