Skip to content

Commit

Permalink
feat: 组件派发消息事件的监听以及自定义事件的监听
Browse files Browse the repository at this point in the history
  • Loading branch information
BUPTlhuanyu committed Sep 7, 2020
1 parent 71742b1 commit 8f2ce45
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/view/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@ Component.prototype.un = function (name, listener) {
*/
Component.prototype.fire = function (name, event) {
var me = this;
// #[begin] devtool
emitDevtool('event-fire', {event, name, me});
// #[end]
each(this.listeners[name], function (listener) {
listener.fn.call(me, event);
});
Expand Down Expand Up @@ -514,7 +517,7 @@ Component.prototype.dispatch = function (name, value) {
parentComponent = parentComponent.parentComponent;
}
// #[begin] devtool
emitDevtool('event-dispatch', {target: this, value: value, name: name, source: dispatched ? parentComponent : null});
emitDevtool('message-dispatch', {target: this, value: value, name: name, source: dispatched ? parentComponent : null});
// #[end]
};

Expand Down

0 comments on commit 8f2ce45

Please sign in to comment.