我知道DOM中的event.type
。我可以解析例如mouseup
,keydown
,touchstart
等。但是,如何检查事件子类?像MouseEvent
,AnimationEvent
或ClipboardEvent
吗?我可以使用event.type
属性吗?
最佳答案
您可以像这样检查类(class)
void myHandler(Event e) {
if(e is MouseEvent) {
print('Mouse');
} else if(e is AnimationEvent) {
print('Animation');
} else if(e is KeyboardEvent) {
print('Keyboard');
}
}
关于dart - 如何检查触发事件的子类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24056780/