Skip to content

Commit 57ff9c0

Browse files
committed
Replace leftover "listener" fields with "effect"
1 parent 8b6a683 commit 57ff9c0

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

docs/api/createListenerMiddleware.mdx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -186,20 +186,20 @@ These are all acceptable:
186186

187187
```js
188188
// 1) Action type string
189-
listenerMiddleware.startListening({ type: 'todos/todoAdded', listener })
189+
listenerMiddleware.startListening({ type: 'todos/todoAdded', effect })
190190
// 2) RTK action creator
191-
listenerMiddleware.startListening({ actionCreator: todoAdded, listener })
191+
listenerMiddleware.startListening({ actionCreator: todoAdded, effect })
192192
// 3) RTK matcher function
193193
listenerMiddleware.startListening({
194194
matcher: isAnyOf(todoAdded, todoToggled),
195-
listener,
195+
effect,
196196
})
197197
// 4) Listener predicate
198198
listenerMiddleware.startListening({
199199
predicate: (action, currentState, previousState) => {
200200
// return true when the listener should run
201201
},
202-
listener,
202+
effect,
203203
})
204204
```
205205

@@ -233,7 +233,7 @@ interface UnsubscribeListenerOptions {
233233
}
234234
```
235235

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.
237237

238238
```js
239239
// Examples:
@@ -244,11 +244,11 @@ listenerMiddleware.stopListening({
244244
cancelActive: true,
245245
})
246246
// 2) RTK action creator
247-
listenerMiddleware.stopListening({ actionCreator: todoAdded, listener })
247+
listenerMiddleware.stopListening({ actionCreator: todoAdded, effect })
248248
// 3) RTK matcher function
249-
listenerMiddleware.stopListening({ matcher, listener, cancelActive: true })
249+
listenerMiddleware.stopListening({ matcher, effect, cancelActive: true })
250250
// 4) Listener predicate
251-
listenerMiddleware.stopListening({ predicate, listener })
251+
listenerMiddleware.stopListening({ predicate, effect })
252252
```
253253

254254
### `clearListeners`
@@ -273,7 +273,7 @@ Dispatching this action returns an `unsubscribe()` callback from `dispatch`.
273273

274274
```js
275275
// 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 }))
277277
```
278278

279279
### `removeListener`
@@ -282,11 +282,11 @@ A standard RTK action creator, imported from the package. Dispatching this actio
282282

283283
By default, this does _not_ cancel any active running instances. However, you may also pass in `{cancelActive: true}` to cancel running instances.
284284

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.
286286

287287
```js
288288
const wasRemoved = store.dispatch(
289-
removeListener({ predicate, listener, cancelActive: true })
289+
removeListener({ predicate, effect, cancelActive: true })
290290
)
291291
```
292292

0 commit comments

Comments
 (0)