google / google/codemirror.dart

events triggered by calls into CodeMirror should be delivered asynchronously

Open
#70 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
89
Forks
34
PR merge metrics
No merged PRs in 30d

Description

mirror.onEvent("focus", false) returns a stream of events that happens whenever CodeMirror gets focus.

Calling mirror.focus() causes an event to be delivered synchronously (in the middle of the focus call). This isn't normal behavior for a Dart stream; usually events are delivered asynchronously (such as in a microtask).

```
#6 _RootZone.runUnaryGuarded (dart:async/zone.dart:1087)
#7 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341)
#8 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:270)
#9 _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:381)
#10 _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:256)
#11 JsEventListener.stream.. (package:codemirror/src/js_utils.dart:62:27)
#12 JsObject._callMethod (dart:js:1132)
#13 JsObject.callMethod (dart:js:1071)
#14 ProxyHolder.call (package:codemirror/codemirror.dart:1207:46)
#15 CodeMirror.focus (package:codemirror/codemirror.dart:348:19)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.