Unclear 'runSaga' options and subscribe field documentation
See original GitHub issueThe documentation about runSaga
options
is very unclear.
First:
options: Object
: https://redux-saga.js.org/docs/api/index.html#runsagaoptions-saga-args
the function signature is runSaga(options, saga, ...args)
But then where the rest of the fields belong to? dispatch(output)
, getState()
?
Do they still belong to the options
?
Second: subscribe
field:
subscribe(callback): Function - A function which accepts a callback and returns an unsubscribe function
callback(input): Function - callback(provided by runSaga) used to subscribe to input events. subscribe must support registering multiple subscriptions.
input: any - argument passed by subscribe to callback (see Notes below)
I am having a really hard time to understand what this means, I suppose the function should look something like this.
subscribe: (callback) => {
//Subscribe function
callback(input);
//Unsubscribe function
return () => { //some code };
},
How can I use it to resolve a take
effects for example?.
Would be nice to have some examples also. In the testing section Testing the full Saga
, there are some nice example, but without using the subscribe
field
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:5 (1 by maintainers)
Top Results From Across the Web
API Reference - Redux-Saga
options : Object - A list of options to pass to the middleware. Currently supported options are: context: Object - initial value of...
Read more >Redux-saga: Calling a saga outside the redux middleware ...
After reading the redux saga docs looks like I have two options either call store.runSaga or use the runSaga utility provided by redux-saga....
Read more >Using SAGA tool in PyQGIS standalone script. Output doesn't ...
In my standalone script I want to use the SAGA tool "merge vector layers". According to the docs I ...
Read more >Clean Water Act Model Pleadings and Discovery from Current ...
Defendant's Second Request for Production of Documents VOLUME III C. Crown Cork ... (g) Plaintiff objects to Interrogatory 3(g) as vague and overly...
Read more >How to Extend Your Visa in Bali, a Step-by-Step Guide
The immigration officers may be a bit confused as to why you want to ... If that's the case, and you entered Visa...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve updated docs around this API - https://github.com/redux-saga/redux-saga/commit/466c5a4f8e941fb0f30a6e6dfb40310883876856 . Keep in mind that it was adjusted to v1, which we are going to release soon.
Is this now clearer or do you feel something still could get improved?
OK regarding my last comment, I improved my code a little bit, it is still not working yet : even if the event emitter works properly, the
channel.put
is called, but the action is never caught. I think there is a problem with the channel but I don’t see where…Here is my code: