[heycam/webidl] Async iterators (#580)

It'd be nice if we could create async iterators in a similar way to iterators.

```webidl
interface Whatever {
  // …
  async_iterable<Something>;
};
```

The prose would need to be a little more complicated than `iterable`, probably written like an generator:

To asynchronously iterate over a `Whatever`, run the following steps:

1. Run these steps *in parallel*:
  1. Let *i* be 0.
  1. While true:
    1. Wait 1 second.
    1. Yield using the networking task source the value of *i*.
    1. Increment *i* by 1.

"Yield" would queue a task on the given task source to resolve the iteration's promise with the given value. The algorithm would not advance until the next iteration was requested.

I guess it's tricky that task sources are an HTML thing, but I can't see how it can be handled correctly otherwise.



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/580

Received on Monday, 20 August 2018 15:33:59 UTC