@@ -186,20 +186,20 @@ These are all acceptable:
186
186
187
187
``` js
188
188
// 1) Action type string
189
- listenerMiddleware .startListening ({ type: ' todos/todoAdded' , listener })
189
+ listenerMiddleware .startListening ({ type: ' todos/todoAdded' , effect })
190
190
// 2) RTK action creator
191
- listenerMiddleware .startListening ({ actionCreator: todoAdded, listener })
191
+ listenerMiddleware .startListening ({ actionCreator: todoAdded, effect })
192
192
// 3) RTK matcher function
193
193
listenerMiddleware .startListening ({
194
194
matcher: isAnyOf (todoAdded, todoToggled),
195
- listener ,
195
+ effect ,
196
196
})
197
197
// 4) Listener predicate
198
198
listenerMiddleware .startListening ({
199
199
predicate : (action , currentState , previousState ) => {
200
200
// return true when the listener should run
201
201
},
202
- listener ,
202
+ effect ,
203
203
})
204
204
```
205
205
@@ -233,7 +233,7 @@ interface UnsubscribeListenerOptions {
233
233
}
234
234
```
235
235
236
- Returns ` true ` if the ` options.effect ` listener has been removed, or ` false ` if no subscription matching the input provided has been found.
236
+ Returns ` true ` if the listener entry has been removed, or ` false ` if no subscription matching the input provided has been found.
237
237
238
238
``` js
239
239
// Examples:
@@ -244,11 +244,11 @@ listenerMiddleware.stopListening({
244
244
cancelActive: true ,
245
245
})
246
246
// 2) RTK action creator
247
- listenerMiddleware .stopListening ({ actionCreator: todoAdded, listener })
247
+ listenerMiddleware .stopListening ({ actionCreator: todoAdded, effect })
248
248
// 3) RTK matcher function
249
- listenerMiddleware .stopListening ({ matcher, listener , cancelActive: true })
249
+ listenerMiddleware .stopListening ({ matcher, effect , cancelActive: true })
250
250
// 4) Listener predicate
251
- listenerMiddleware .stopListening ({ predicate, listener })
251
+ listenerMiddleware .stopListening ({ predicate, effect })
252
252
```
253
253
254
254
### ` clearListeners `
@@ -273,7 +273,7 @@ Dispatching this action returns an `unsubscribe()` callback from `dispatch`.
273
273
274
274
``` js
275
275
// Per above, provide `predicate` or any of the other comparison options
276
- const unsubscribe = store .dispatch (addListener ({ predicate, listener }))
276
+ const unsubscribe = store .dispatch (addListener ({ predicate, effect }))
277
277
```
278
278
279
279
### ` removeListener `
@@ -282,11 +282,11 @@ A standard RTK action creator, imported from the package. Dispatching this actio
282
282
283
283
By default, this does _ not_ cancel any active running instances. However, you may also pass in ` {cancelActive: true} ` to cancel running instances.
284
284
285
- Returns ` true ` if the ` options. listener` listener has been removed, ` false ` if no subscription matching the input provided has been found.
285
+ Returns ` true ` if the listener entry has been removed, ` false ` if no subscription matching the input provided has been found.
286
286
287
287
``` js
288
288
const wasRemoved = store .dispatch (
289
- removeListener ({ predicate, listener , cancelActive: true })
289
+ removeListener ({ predicate, effect , cancelActive: true })
290
290
)
291
291
```
292
292
0 commit comments