From 1e333877f43175a4ec4d403edd298ac61450fd8b Mon Sep 17 00:00:00 2001 From: Thomas Brouard Date: Tue, 1 Nov 2016 13:53:19 +0100 Subject: [PATCH] Add ready callbacks for TabGroup and Tab --- index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 8460bf0..642e3fc 100644 --- a/index.js +++ b/index.js @@ -38,13 +38,17 @@ class TabGroup extends EventEmitter { viewClass: args.viewClass || "tabs-view", closeButtonText: args.closeButtonText || "❌", newTab: args.newTab, - newTabButtonText: args.newTabButton || "+" + newTabButtonText: args.newTabButton || "+", + ready: args.ready }; this.tabContainer = document.querySelector(options.tabContainerSelector); this.viewContainer = document.querySelector(options.viewContainerSelector); this.tabs = []; this.newTabId = 0; this.initNewTabButton(); + if (typeof this.options.ready === "function") { + this.options.ready(this); + } } initNewTabButton () { @@ -115,6 +119,9 @@ class Tab extends EventEmitter { this.tabElements = {}; this.initTab(); this.initWebview(); + if (typeof args.ready === "function") { + args.ready(this); + } } initTab () {