netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

JavaScript to support "for await of"

Open brettryan opened this issue 3 years ago • 0 comments

Description

As a javacript developer I would like to have support for for await...of (ECMAScript specification) so that I can write asynchronous iterators using the for keyword.

Taken from the MDN for await...of example, the following for await statement uses an asynchronous iterator to produce its output

async function* foo() {
  yield 1;
  yield 2;
}

(async function() {
  for await (const num of foo()) {
    console.log(num);   // expected output: 1
    break;              // closes iterator, triggers return
  }
})();

Presently this produces the following error message:

Expected ( but found await

Use case/motivation

Working with NodeJS applications such as AWS Lambda works with a lot of async code. Having native support for this within NetBeans IDE provides a better developer experience.

I am willing to contribute with guidance.

Related issues

No response

Are you willing to submit a pull request?

Yes

Code of Conduct

Yes

brettryan avatar Oct 09 '22 05:10 brettryan