git ssb

0+

cel-desktop / ssb-pkg



Tree: ca90b5ca0579ebdcc0635288bce4978e3fb200f5

Files: ca90b5ca0579ebdcc0635288bce4978e3fb200f5 / test / test-50-for-await-of / test-x-index.js

619 bytesRaw
1'use strict';
2
3class AsyncIterator {
4 constructor () {
5 this.limit = 5;
6 this.current = 0;
7 }
8
9 next () {
10 this.current += 1;
11 let done = this.current > this.limit;
12 return Promise.resolve({
13 value: done ? undefined : this.current,
14 done
15 });
16 }
17
18 [Symbol.asyncIterator] () {
19 return this;
20 }
21}
22
23// The function does have an await (in the for-await-of loop), ESLint just doesn't seem to detect it
24/* eslint-disable require-await */
25async function t () {
26 /* eslint-enable require-await */
27 let it = new AsyncIterator();
28 for await (let x of it) {
29 console.log(x);
30 }
31}
32
33t();
34

Built with git-ssb-web