Your usage does not comply with the specification. Co allows yielding a promise, generator, array, and object, but does not allow yielding an ordinary function. It must be a paradigm function; When yielding the first setTimeout, the function executes normally. , but an error is reported after execution:
TypeError: You may only yield a function, promise, generator, array, or object, but the following object was passed: "[object Object]"
The error report will naturally be interrupted, so the code will not continue to execute. As for why you know the above error is reported, it will be clear when you read the source code carefully
Your usage does not comply with the specification. Co allows yielding a promise, generator, array, and object, but does not allow yielding an ordinary function. It must be a paradigm function;
When yielding the first setTimeout, the function executes normally. , but an error is reported after execution:
The error report will naturally be interrupted, so the code will not continue to execute. As for why you know the above error is reported, it will be clear when you read the source code carefully
tj/co is not perfect, you can use co in hprose instead of tj/co, here is an introduction article:
https://segmentfault.com/a/11...