We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ec134b9 commit 0e32cc0Copy full SHA for 0e32cc0
packages/utils/testing/src/events.js
@@ -22,15 +22,21 @@ class Events {
22
this.handlers[ev].push(sinon.spy(cb));
23
}
24
25
- emit(ev, ...args) {
26
-
+ async emit(ev, ...args) {
27
this.emissions[ev] = args;
+ return this.trigger(ev);
28
+ }
29
+
30
+ once(name, cb) {
31
+ cb();
32
33
34
+ async trigger(ev, ...args) {
35
if (!this.handlers[ev]) {
36
return;
37
38
- this.handlers[ev].forEach(h => h(...args));
39
+ await Promise.all(this.handlers[ev].map(async h => h(args)));
40
41
42
request(cmd, ...args) {
0 commit comments