@@ -7,8 +7,8 @@ test("distribute to self", () => {
7
7
8
8
const client0Heard : ReceivedUpdate < string > [ ] = [ ] ;
9
9
10
- client0 . setUpdateListener ( ( update ) => {
11
- client0Heard . push ( update ) ;
10
+ client0 . setUpdateListenerMulti ( ( updates ) => {
11
+ client0Heard . push ( ... updates ) ;
12
12
} , 0 ) ;
13
13
14
14
client0 . sendUpdate ( { payload : "Hello" } , "update" ) ;
@@ -26,12 +26,12 @@ test("distribute to self and other", () => {
26
26
const client0Heard : ReceivedUpdate < string > [ ] = [ ] ;
27
27
const client1Heard : ReceivedUpdate < string > [ ] = [ ] ;
28
28
29
- client0 . setUpdateListener ( ( update ) => {
30
- client0Heard . push ( update ) ;
29
+ client0 . setUpdateListenerMulti ( ( updates ) => {
30
+ client0Heard . push ( ... updates ) ;
31
31
} , 0 ) ;
32
32
33
- client1 . setUpdateListener ( ( update ) => {
34
- client1Heard . push ( update ) ;
33
+ client1 . setUpdateListenerMulti ( ( updates ) => {
34
+ client1Heard . push ( ... updates ) ;
35
35
} , 0 ) ;
36
36
37
37
client0 . sendUpdate ( { payload : "Hello" } , "update" ) ;
@@ -54,12 +54,12 @@ test("setUpdateListener serial should skip older", () => {
54
54
const client0Heard : ReceivedUpdate < string > [ ] = [ ] ;
55
55
const client1Heard : ReceivedUpdate < string > [ ] = [ ] ;
56
56
57
- client0 . setUpdateListener ( ( update ) => {
58
- client0Heard . push ( update ) ;
57
+ client0 . setUpdateListenerMulti ( ( updates ) => {
58
+ client0Heard . push ( ... updates ) ;
59
59
} , 0 ) ;
60
60
61
- client1 . setUpdateListener ( ( update ) => {
62
- client1Heard . push ( update ) ;
61
+ client1 . setUpdateListenerMulti ( ( updates ) => {
62
+ client1Heard . push ( ... updates ) ;
63
63
} , 1 ) ;
64
64
65
65
client0 . sendUpdate ( { payload : "Hello" } , "update" ) ;
@@ -81,8 +81,8 @@ test("other starts listening later", () => {
81
81
const client0Heard : ReceivedUpdate < string > [ ] = [ ] ;
82
82
const client1Heard : ReceivedUpdate < string > [ ] = [ ] ;
83
83
84
- client0 . setUpdateListener ( ( update ) => {
85
- client0Heard . push ( update ) ;
84
+ client0 . setUpdateListenerMulti ( ( updates ) => {
85
+ client0Heard . push ( ... updates ) ;
86
86
} , 0 ) ;
87
87
88
88
client0 . sendUpdate ( { payload : "Hello" } , "update" ) ;
@@ -95,8 +95,8 @@ test("other starts listening later", () => {
95
95
// we only join later, so we haven't heard a thing yet
96
96
expect ( client1Heard ) . toMatchObject ( [ ] ) ;
97
97
98
- client1 . setUpdateListener ( ( update ) => {
99
- client1Heard . push ( update ) ;
98
+ client1 . setUpdateListenerMulti ( ( updates ) => {
99
+ client1Heard . push ( ... updates ) ;
100
100
} , 0 ) ;
101
101
102
102
expect ( client0Heard ) . toMatchObject ( [
@@ -116,8 +116,8 @@ test("client is created later and needs to catch up", () => {
116
116
const client0Heard : ReceivedUpdate < string > [ ] = [ ] ;
117
117
const client1Heard : ReceivedUpdate < string > [ ] = [ ] ;
118
118
119
- client0 . setUpdateListener ( ( update ) => {
120
- client0Heard . push ( update ) ;
119
+ client0 . setUpdateListenerMulti ( ( updates ) => {
120
+ client0Heard . push ( ... updates ) ;
121
121
} , 0 ) ;
122
122
123
123
client0 . sendUpdate ( { payload : "Hello" } , "update" ) ;
@@ -132,8 +132,8 @@ test("client is created later and needs to catch up", () => {
132
132
expect ( client1Heard ) . toMatchObject ( [ ] ) ;
133
133
const client1 = processor . createClient ( "3002" ) ;
134
134
135
- client1 . setUpdateListener ( ( update ) => {
136
- client1Heard . push ( update ) ;
135
+ client1 . setUpdateListenerMulti ( ( updates ) => {
136
+ client1Heard . push ( ... updates ) ;
137
137
} , 0 ) ;
138
138
139
139
expect ( client0Heard ) . toMatchObject ( [
@@ -154,8 +154,8 @@ test("other starts listening later but is partially caught up", () => {
154
154
const client0Heard : ReceivedUpdate < string > [ ] = [ ] ;
155
155
const client1Heard : ReceivedUpdate < string > [ ] = [ ] ;
156
156
157
- client0 . setUpdateListener ( ( update ) => {
158
- client0Heard . push ( update ) ;
157
+ client0 . setUpdateListenerMulti ( ( updates ) => {
158
+ client0Heard . push ( ... updates ) ;
159
159
} , 0 ) ;
160
160
161
161
client0 . sendUpdate ( { payload : "Hello" } , "update" ) ;
@@ -168,8 +168,8 @@ test("other starts listening later but is partially caught up", () => {
168
168
expect ( client1Heard ) . toMatchObject ( [ ] ) ;
169
169
170
170
// start at 1, as we're already partially caught up
171
- client1 . setUpdateListener ( ( update ) => {
172
- client1Heard . push ( update ) ;
171
+ client1 . setUpdateListenerMulti ( ( updates ) => {
172
+ client1Heard . push ( ... updates ) ;
173
173
} , 1 ) ;
174
174
175
175
expect ( client0Heard ) . toMatchObject ( [
0 commit comments