addTab and options.newTab can be a function
This commit is contained in:
parent
e98e4141c5
commit
fe859786ae
1 changed files with 3 additions and 0 deletions
3
index.js
3
index.js
|
@ -57,6 +57,9 @@ class TabGroup extends EventEmitter {
|
|||
}
|
||||
|
||||
addTab (args = this.options.newTab) {
|
||||
if (typeof args === "function") {
|
||||
args = args(this);
|
||||
}
|
||||
let id = this.newTabId;
|
||||
this.newTabId++;
|
||||
let tab = new Tab(this, id, args);
|
||||
|
|
Loading…
Reference in a new issue