Browse Source

Merge pull request #292707 in DEC/fineui from master to feature/x

* commit '2ca1c7bca03d88f45feee6effed11eadc271a07f':
  BI-155367 fix: 兜底处理一下,避免执行事件回调的时候同步移除回调,导致后续遍历执行报错
master
superman 1 month ago
parent
commit
ad0c75d4d7
  1. 6
      packages/fineui/src/core/controller/controller.broadcast.js

6
packages/fineui/src/core/controller/controller.broadcast.js

@ -16,13 +16,13 @@ export class BroadcastController extends Controller {
this._broadcasts[name] = [];
}
this._broadcasts[name].push(fn);
return () => this.remove(name, fn);
}
send(name) {
const args = [].slice.call(arguments, 1);
each(this._broadcasts[name], (i, fn) => fn(...args));
each(this._broadcasts[name]?.slice?.(), (i, fn) => fn(...args));
}
remove(name, fn) {
@ -34,7 +34,7 @@ export class BroadcastController extends Controller {
} else {
delete this._broadcasts[name];
}
return this;
}
}

Loading…
Cancel
Save