MCPcopy
hub / github.com/redux-loop/redux-loop / executeCmdInternal

Function executeCmdInternal

src/cmd.js:169–206  ·  view source on GitHub ↗
(cmd, context)

Source from the content-addressed store, hash-verified

167}
168
169function executeCmdInternal(cmd, context) {
170 switch (cmd.type) {
171 case cmdTypes.RUN:
172 return handleRunCmd(cmd, context);
173
174 case cmdTypes.ACTION:
175 return Promise.resolve([cmd.actionToDispatch]);
176
177 case cmdTypes.SET_TIMEOUT:
178 case cmdTypes.SET_INTERVAL:
179 return handleDelayCmd(cmd, context);
180
181 case cmdTypes.LIST:
182 return cmd.sequence
183 ? handleSequenceList(cmd, context)
184 : handleParallelList(cmd, context);
185
186 case cmdTypes.MAP: {
187 const possiblePromise = executeCmdInternal(cmd.nestedCmd, {
188 ...context,
189 wrappedDispatch: (action) =>
190 context.wrappedDispatch(cmd.tagger(...cmd.args, action)),
191 });
192 if (!possiblePromise) {
193 return null;
194 }
195 return possiblePromise.then((actions) =>
196 actions.map((action) => cmd.tagger(...cmd.args, action))
197 );
198 }
199
200 case cmdTypes.NONE:
201 return null;
202
203 default:
204 throw new Error(`Invalid Cmd type ${cmd.type}`);
205 }
206}
207
208function simulateRun({ result, success }) {
209 if (success && this.successActionCreator) {

Callers 4

handleParallelListFunction · 0.85
handleSequenceListFunction · 0.85
executeNestedCmdFunction · 0.85
executeCmdFunction · 0.85

Calls 4

handleRunCmdFunction · 0.85
handleDelayCmdFunction · 0.85
handleSequenceListFunction · 0.85
handleParallelListFunction · 0.85

Tested by

no test coverage detected