Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of @@asyncIterator is bad #6

Open
0kku opened this issue May 8, 2020 · 0 comments
Open

Implementation of @@asyncIterator is bad #6

0kku opened this issue May 8, 2020 · 0 comments
Labels
discussion Discuss the design of the library upstream Depends on open upstream issues
Milestone

Comments

@0kku
Copy link
Owner

0kku commented May 8, 2020

The current implementation of [Symbol.asyncIterator]() on ReactiveArray and ReactivePrimitive is very sketchy. However, this doesn't seem to be practically fixable until browsers support ReadableStream::getIterator():

  // for ReactiveArray
  async *[Symbol.asyncIterator]() {
    yield* new ReadableStream<[number, number, ...IArrayValueType<InputType>[]]>({
      start: controller => this.#callbacks.add(
        (
          ...args: [number, number, ...IArrayValueType<InputType>[]]
        ) => controller.enqueue(args)
      ),
    }).getIterator();
  }

Depends on:

@0kku 0kku added the discussion Discuss the design of the library label May 8, 2020
@0kku 0kku added the upstream Depends on open upstream issues label Nov 2, 2021
@0kku 0kku added this to the Future milestone Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Discuss the design of the library upstream Depends on open upstream issues
Projects
None yet
Development

No branches or pull requests

1 participant