My class looks like this:
abstract class Processor {
canBeRun(action: RootActions, curOrderModal: OrderModalStep, curOrderPage: OrderPageStep): boolean {
throw new Error('The method must override, canBeRun()');
}
*_process(): Generator<any, any, any> {
throw new Error('The method must override, _process()');
}
}
class OrignalMembersOrder extends Processor {
constructor() {
super();
}
*_process(): Generator<any, any, any> {
try {
yield put(setCurOrderPage(OrderPageStep.original));//
} catch (error) {
console.log('error');
}
}
}
export function* test(): Generator<any, any, any> {
const Array: Processor[] = [];
Array.push(new OrignalMembersOrder());
//Array.push(new OtherOrder...());
//Array.push(new OtherOrder...());
//Array.push(new OtherOrder...());
}
Array.map((processors) => {
processors._process().next();
});
and call the _process().next() method, I don't get the expected result ...
This part doesn't work
*_process(): Generator<any, any, any> {
try {
yield console.log("check") // success
yield put(setCurOrderPage(OrderPageStep.original)); // failure
} catch (error) {
console.log('error');
}
}
yield console.log <- success
yield put(setCurOrderPage(OrderPageStep.original)) <- failure