Update index.js

This commit is contained in:
Bastian Küppers 2017-02-15 12:58:52 +01:00 committed by GitHub
parent 537b87dbc0
commit a861267b46

View file

@ -38,7 +38,7 @@ class TabGroup extends EventEmitter {
viewClass: args.viewClass || "etabs-view", viewClass: args.viewClass || "etabs-view",
closeButtonText: args.closeButtonText || "✖", closeButtonText: args.closeButtonText || "✖",
newTab: args.newTab, newTab: args.newTab,
newTabButtonText: args.newTabButton || "+", newTabButtonText: args.newTabButtonText || "+",
ready: args.ready ready: args.ready
}; };
this.tabContainer = document.querySelector(options.tabContainerSelector); this.tabContainer = document.querySelector(options.tabContainerSelector);
@ -124,7 +124,7 @@ class Tab extends EventEmitter {
this.id = id; this.id = id;
this.title = args.title; this.title = args.title;
this.iconURL = args.iconURL; this.iconURL = args.iconURL;
this.icon = args.icon; this.icon = args.icon;
this.closable = args.closable === false ? false : true; this.closable = args.closable === false ? false : true;
this.webviewAttributes = args.webviewAttributes || {}; this.webviewAttributes = args.webviewAttributes || {};
this.webviewAttributes.src = args.src; this.webviewAttributes.src = args.src;
@ -158,31 +158,26 @@ class Tab extends EventEmitter {
setIcon (iconURL, icon) { setIcon (iconURL, icon) {
if (this.isClosed) return; if (this.isClosed) return;
this.iconURL = iconURL; this.iconURL = iconURL;
this.icon = icon; this.icon = icon;
let span = this.tabElements.icon; let span = this.tabElements.icon;
if (iconURL) { if (iconURL) {
span.innerHTML = `<img src="${iconURL}" />`; span.innerHTML = `<img src="${iconURL}" />`;
this.emit("icon-changed", iconURL, this);
} else if (icon) { } else if (icon) {
span.innerHTML = `<i class="${icon}"></i>`; span.innerHTML = `<i class="${icon}"></i>`;
this.emit("icon-changed", icon, this);
} }
this.emit("icon-changed", iconURL, this);
return this; return this;
} }
getIcon () { getIcon () {
if (this.isClosed) return; if (this.isClosed) return;
return this.icon; if(this.iconURL) return this.iconURL;
return this.icon;
} }
getIconUrl () {
if (this.isClosed) return ;
return this.iconURL;
}
activate () { activate () {
if (this.isClosed) return; if (this.isClosed) return;
let activeTab = this.tabGroup.getActiveTab(); let activeTab = this.tabGroup.getActiveTab();