mirror of
https://ark.sudovanilla.org/Korbs/electron-tabs.git
synced 2024-12-23 03:53:53 +00:00
Add ready callbacks for TabGroup and Tab
This commit is contained in:
parent
fe859786ae
commit
1e333877f4
9
index.js
9
index.js
|
@ -38,13 +38,17 @@ class TabGroup extends EventEmitter {
|
||||||
viewClass: args.viewClass || "tabs-view",
|
viewClass: args.viewClass || "tabs-view",
|
||||||
closeButtonText: args.closeButtonText || "❌",
|
closeButtonText: args.closeButtonText || "❌",
|
||||||
newTab: args.newTab,
|
newTab: args.newTab,
|
||||||
newTabButtonText: args.newTabButton || "+"
|
newTabButtonText: args.newTabButton || "+",
|
||||||
|
ready: args.ready
|
||||||
};
|
};
|
||||||
this.tabContainer = document.querySelector(options.tabContainerSelector);
|
this.tabContainer = document.querySelector(options.tabContainerSelector);
|
||||||
this.viewContainer = document.querySelector(options.viewContainerSelector);
|
this.viewContainer = document.querySelector(options.viewContainerSelector);
|
||||||
this.tabs = [];
|
this.tabs = [];
|
||||||
this.newTabId = 0;
|
this.newTabId = 0;
|
||||||
this.initNewTabButton();
|
this.initNewTabButton();
|
||||||
|
if (typeof this.options.ready === "function") {
|
||||||
|
this.options.ready(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initNewTabButton () {
|
initNewTabButton () {
|
||||||
|
@ -115,6 +119,9 @@ class Tab extends EventEmitter {
|
||||||
this.tabElements = {};
|
this.tabElements = {};
|
||||||
this.initTab();
|
this.initTab();
|
||||||
this.initWebview();
|
this.initWebview();
|
||||||
|
if (typeof args.ready === "function") {
|
||||||
|
args.ready(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initTab () {
|
initTab () {
|
||||||
|
|
Loading…
Reference in a new issue