I've read the Invoking Multiple Services section, which says that one could invoke multiple promises, but in my own tests they look to be invoked without waiting for the previous to finish
// ...
invoke: [
{ id: 'service1', src: 'someService' },
{ id: 'service2', src: 'someService' },
{ id: 'logService', src: 'logService' }
],
// ...
Here is an answer as well with the workaround of creating intermediary states
states: {
first: {
invoke: {
src: 'one',
onDone: {
target: 'second',
}
}
},
second: {
invoke: {
src: 'two',
onDone: {
target: 'success',
}
}
},
success: {
type: 'final'
}
}
Is there a way to do chaining like Promise.each
, with invokes, making the invoke([]) run serially maybe ?
I can only see two options:
- Intermediate states
- Call one promise that does the chaining in itself.