Allow to customize observing attributes

This commit is contained in:
YUKI Hiroshi 2016-02-12 19:56:57 +09:00
parent 289181d28b
commit 32cd96d1f2
2 changed files with 13 additions and 6 deletions

View File

@ -299,9 +299,13 @@ GroupTab.prototype = inherit(TreeStyleTabBase, {
tab.parentNode.addEventListener(this.kEVENT_TYPE_ATTACHED, this, false);
tab.parentNode.addEventListener(this.kEVENT_TYPE_DETACHED, this, false);
this.tabsObserver = new TabAttributesObserver(this.browser.tabContainer, (function(aTab) {
this.onTabModified(aTab);
}).bind(this));
this.tabsObserver = new TabAttributesObserver({
container : this.browser.tabContainer,
attributes : 'label,visibleLabel,image',
callback : (function(aTab) {
this.onTabModified(aTab);
}).bind(this)
});
this.editor.addEventListener('keypress', this, false);

View File

@ -37,9 +37,12 @@ var EXPORTED_SYMBOLS = ['TabAttributesObserver'];
Components.utils.import('resource://treestyletab-modules/constants.js');
function TabAttributesObserver(aContainer, aCallback) {
this.container = aContainer;
this.callback = aCallback;
function TabAttributesObserver(aParams) {
this.container = aParams.container;
this.attributes = aParams.attributes;
if (typeof this.attributes == 'string')
this.attributes = this.attributes.split(',');
this.callback = aParams.callback;
this.init();
}
TabAttributesObserver.prototype = {