Skip to content

Commit c07517b

Browse files
add generic comments to the core algorithm
1 parent d3ce078 commit c07517b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

modules/Coroutine.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,16 @@ class Coroutine extends Component {
4040
};
4141

4242
if (isPromiseLike(asyncBody)) {
43+
// asyncFn is Async Function, awaiting for the final result
4344
asyncBody.then(updater);
4445
} else {
4546
const step = this.iterator.next();
4647

4748
if (isPromiseLike(step)) {
49+
// asyncFn is Async Generator, rendering every time it yields
4850
resolveAsyncIterator(this.iterator, step, updater);
4951
} else {
52+
// asyncFn is Sync Generator, rendering the final result, awaiting yielded promises
5053
resolveSyncIterator(this.iterator, step, updater);
5154
}
5255
}

0 commit comments

Comments
 (0)