W3C home > Mailing lists > Public > public-webrtc@w3.org > November 2012

Re: [ACTION-59] Introduce lookup by id structures for streams and tracks.

From: Anant Narayanan <anant@mozilla.com>
Date: Mon, 05 Nov 2012 05:59:22 -0800
Message-ID: <5097C63A.8050606@mozilla.com>
To: "public-webrtc@w3.org" <public-webrtc@w3.org>
On 11/5/12 5:36 AM, Adam Bergkvist wrote:
> Here are two options on how to solve item 2) (iteration) from the list
> above. I you have a better approach, feel free to suggest it.
> A) forEachStream()/forEachTrack() method
> You iterate through all the items by providing a callback to the
> forEachStream() method. The callback will be called synchronously for
> each item.
> Example:
> pc.localStreams.forEachStream(function (stream) {
>      // use stream
> });
> We could have the callback return a boolean value which could be used to
> "break" the iteration if the desired item was found before the end was
> reached.

Why not simply .forEach?

Between A and B, I prefer the forEach approach, but I think we can just 
reuse the .forEach already specified for arrays instead of introducing a 
new method.

Received on Monday, 5 November 2012 13:59:50 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:17:35 UTC