EventTarget 这个事件到底是同步还是异步
let ev = new cc.EventTarget();
ev.on('aaa', () => {
console.log('recv aaa');
})
this.scheduleOnce(() => {
console.log('bbb');
})
console.log('before emit');
ev.emit('aaa');
console.log('after emit');
日志输出
-
Simulator: JS: before emit
-
Simulator: JS: recv aaa
-
Simulator: JS: after emit
-
Simulator: JS: bbb
一帧之内就执行了回调,应该不算异步了吧