我正在寻找Dart API来找到一种使用捕获模式监听KeyUp事件的方法.但是使用这个新的流系统,没有参数可以指定捕获了:
document.body.onKeyUp.listen(callback); // where's the old "useCapture" parameter?
Run Code Online (Sandbox Code Playgroud)
为了实现与Streams相同的功能,这里有一个例子:
Element.keyUpEvent.forTarget(document.body, useCapture: true).listen((e) {
// Do your stuff.
print('Here we go');
});
Run Code Online (Sandbox Code Playgroud)
我们上面使用的方法使用捕获模式为您创建流.Stream接口(listen()方法)非常通用,因此无法具备您正在寻找的特定功能.
| 归档时间: |
|
| 查看次数: |
202 次 |
| 最近记录: |