You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-6Lines changed: 16 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,11 +29,14 @@ class Event5 extends AbstractEvent<string> {
29
29
}
30
30
```
31
31
32
-
When redispatching an event, you must call `event.clone()`. The same instance cannot be redispatched. When the event is cloned, all constructor parameters are shallow-copied.
32
+
When redispatching an event, you must call `event.clone()`. The same instance
33
+
cannot be redispatched. When the event is cloned, all constructor parameters are
34
+
shallow-copied.
33
35
34
36
### `Evented`
35
37
36
-
We combine `Evented` with `AbstractEvent` to gain type-safety and convenience of the wildcard any handler.
38
+
We combine `Evented` with `AbstractEvent` to gain type-safety and convenience of
You can use this style to handle relevant events to perform side-effects, as well as propagate upwards irrelevant events.
68
+
You can use this style to handle relevant events to perform side-effects, as
69
+
well as propagate upwards irrelevant events.
66
70
67
-
Note that some side-effects you perform may trigger an infinite loop by causing something to emit the specific event type that you are handling. In these cases you should specialise handling of those events with a `once: true` option, so that they are only handled once.
71
+
Note that some side-effects you perform may trigger an infinite loop by causing
72
+
something to emit the specific event type that you are handling. In these cases
73
+
you should specialise handling of those events with a `once: true` option, so
74
+
that they are only handled once.
68
75
69
76
```ts
70
77
x.addEventListener(
@@ -79,9 +86,12 @@ x.addEventListener(
79
86
80
87
This will terminate the infinite loop on the first time it gets handled.
81
88
82
-
Therefore it is a good idea to always be as specific with your event types as possible.
89
+
Therefore it is a good idea to always be as specific with your event types as
90
+
possible.
83
91
84
-
Furthermore any unhandled rejections or uncaught exceptions will be redispatched as `EventError`. However if there's no listener registered for this, it will be thrown up as an uncaught exception.
92
+
Furthermore any unhandled rejections or uncaught exceptions will be redispatched
93
+
as `EventError`. However if there's no listener registered for this, it will be
0 commit comments