diff --git a/bi/core.js b/bi/core.js index 05d821f9b1..e47cc4482b 100644 --- a/bi/core.js +++ b/bi/core.js @@ -3198,9 +3198,9 @@ if (!window.BI) { var numMod = format.indexOf(';'); if (numMod > -1) { if (text >= 0) { - return BI._numberFormat(text + "", format.substring(0, numMod)); + return _numberFormat(text + "", format.substring(0, numMod)); } else { - return BI._numberFormat((-text) + "", format.substr(numMod + 1)); + return _numberFormat((-text) + "", format.substr(numMod + 1)); } } var tp = text.split('.'), fp = format.split('.'), @@ -15368,7 +15368,7 @@ BI.BroadcastController = BI.inherit(BI.Controller, { } this._broadcasts[name].push(fn); return function () { - self._broadcasts[name].remove(fn); + self.remove(name, fn); } }, @@ -15382,6 +15382,9 @@ BI.BroadcastController = BI.inherit(BI.Controller, { remove: function (name, fn) { if (fn) { this._broadcasts[name].remove(fn); + if (this._broadcasts[name].length === 0) { + delete this._broadcasts[name]; + } } else { delete this._broadcasts[name]; } @@ -15968,11 +15971,14 @@ BI.ResizeController = BI.inherit(BI.Controller, { }, add: function (name, resizer) { + var self = this; if (this.has(name)) { return this; } this.resizerManger[name] = resizer; - return this; + return function () { + self.remove(name); + }; }, get: function (name) { diff --git a/dist/core.js b/dist/core.js index ee87da9609..9c8a9f4bfe 100644 --- a/dist/core.js +++ b/dist/core.js @@ -19876,9 +19876,9 @@ BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";;(function () { var numMod = format.indexOf(';'); if (numMod > -1) { if (text >= 0) { - return BI._numberFormat(text + "", format.substring(0, numMod)); + return _numberFormat(text + "", format.substring(0, numMod)); } else { - return BI._numberFormat((-text) + "", format.substr(numMod + 1)); + return _numberFormat((-text) + "", format.substr(numMod + 1)); } } var tp = text.split('.'), fp = format.split('.'), @@ -20441,7 +20441,7 @@ BI.BroadcastController = BI.inherit(BI.Controller, { } this._broadcasts[name].push(fn); return function () { - self._broadcasts[name].remove(fn); + self.remove(name, fn); } }, @@ -20455,6 +20455,9 @@ BI.BroadcastController = BI.inherit(BI.Controller, { remove: function (name, fn) { if (fn) { this._broadcasts[name].remove(fn); + if (this._broadcasts[name].length === 0) { + delete this._broadcasts[name]; + } } else { delete this._broadcasts[name]; } @@ -21041,11 +21044,14 @@ BI.ResizeController = BI.inherit(BI.Controller, { }, add: function (name, resizer) { + var self = this; if (this.has(name)) { return this; } this.resizerManger[name] = resizer; - return this; + return function () { + self.remove(name); + }; }, get: function (name) { diff --git a/src/core/alias.js b/src/core/alias.js index d86d76af8b..0abe30e403 100644 --- a/src/core/alias.js +++ b/src/core/alias.js @@ -186,9 +186,9 @@ var numMod = format.indexOf(';'); if (numMod > -1) { if (text >= 0) { - return BI._numberFormat(text + "", format.substring(0, numMod)); + return _numberFormat(text + "", format.substring(0, numMod)); } else { - return BI._numberFormat((-text) + "", format.substr(numMod + 1)); + return _numberFormat((-text) + "", format.substr(numMod + 1)); } } var tp = text.split('.'), fp = format.split('.'), diff --git a/src/core/controller/controller.broadcast.js b/src/core/controller/controller.broadcast.js index 7b7c43984f..202f2432e5 100644 --- a/src/core/controller/controller.broadcast.js +++ b/src/core/controller/controller.broadcast.js @@ -21,7 +21,7 @@ BI.BroadcastController = BI.inherit(BI.Controller, { } this._broadcasts[name].push(fn); return function () { - self._broadcasts[name].remove(fn); + self.remove(name, fn); } }, @@ -35,6 +35,9 @@ BI.BroadcastController = BI.inherit(BI.Controller, { remove: function (name, fn) { if (fn) { this._broadcasts[name].remove(fn); + if (this._broadcasts[name].length === 0) { + delete this._broadcasts[name]; + } } else { delete this._broadcasts[name]; } diff --git a/src/core/controller/controller.resizer.js b/src/core/controller/controller.resizer.js index 04ad57869b..d45b13bc9c 100644 --- a/src/core/controller/controller.resizer.js +++ b/src/core/controller/controller.resizer.js @@ -41,11 +41,14 @@ BI.ResizeController = BI.inherit(BI.Controller, { }, add: function (name, resizer) { + var self = this; if (this.has(name)) { return this; } this.resizerManger[name] = resizer; - return this; + return function () { + self.remove(name); + }; }, get: function (name) {