By handling the event, you can check some conditions and optionally cancel the event by setting the cancel property to true.
处理事件时,您能够检查一些条件,通过将Cance l属性设置为真选择取消事件。
The event source does not need to manage any event-related resources except for the emitter as all resource handling is performed by the emitter factory and emitter instances themselves.
除了发射器,事件源不必管理任何与事件相关的资源,因为所有的资源处理都是由发射器工厂和发射器实例自身执行的。
This complexity is partly caused by the common mistake of implementing the event method with a large if statement to capture all the handling logic.
造成这种复杂性的部分原因是出现了一种常见的错误:通过大量的if语句捕捉所有处理逻辑来实现event方法。
应用推荐