测试下来,removeAll 和 targetOff的一模一样的,是我理解有问题吗?
this.eventTarget = new EventTarget();
this.node1 = new Node();
this.node2 = new Node();
this.node.addChild(this.node1)
this.node.addChild(this.node2);
this.eventTarget.on('run', this.log1, this);
this.eventTarget.on('run', this.log2, this);
this.eventTarget.on('run', this.log3, this.node1);
this.eventTarget.on('run', this.log4, this.node2);
this.eventTarget.targetOff(this);
//this.eventTarget.targetOff(‘run’);
this.eventTarget.emit(‘run’);
或者
this.eventTarget.removeAll(this);
//this.eventTarget.removeAll(‘run’);
this.eventTarget.emit(‘run’);