Browse Source

无JIRA 更新一下BI.broadcasts.remove 的写法. 因为on方法return了一个remove方法. 所以不能把fn作为predicate

es6
Dailer 3 years ago
parent
commit
e0631b23af
  1. 4
      src/core/controller/controller.broadcast.js

4
src/core/controller/controller.broadcast.js

@ -30,7 +30,9 @@ BI.BroadcastController = BI.inherit(BI.Controller, {
remove: function (name, fn) { remove: function (name, fn) {
var self = this; var self = this;
if (fn) { if (fn) {
BI.remove(this._broadcasts[name], fn); BI.remove(this._broadcasts[name], function (index, cb) {
return fn === cb;
});
if (this._broadcasts[name].length === 0) { if (this._broadcasts[name].length === 0) {
delete this._broadcasts[name]; delete this._broadcasts[name];
} }

Loading…
Cancel
Save