addTab and options.newTab can be a function

This commit is contained in:
Thomas Brouard 2016-11-01 11:21:48 +01:00
parent e98e4141c5
commit fe859786ae

View file

@ -57,6 +57,9 @@ class TabGroup extends EventEmitter {
} }
addTab (args = this.options.newTab) { addTab (args = this.options.newTab) {
if (typeof args === "function") {
args = args(this);
}
let id = this.newTabId; let id = this.newTabId;
this.newTabId++; this.newTabId++;
let tab = new Tab(this, id, args); let tab = new Tab(this, id, args);