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

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

From: Suhas Nandakumar (snandaku) <snandaku@cisco.com>
Date: Mon, 5 Nov 2012 15:49:25 +0000
To: Anant Narayanan <anant@mozilla.com>, "public-webrtc@w3.org" <public-webrtc@w3.org>
Message-ID: <37D91FC30D69DE43B61E5EEADD959F18031C247D@xmb-aln-x12.cisco.com>

From: Anant Narayanan [anant@mozilla.com]
Sent: Monday, November 05, 2012 5:59 AM
To: public-webrtc@w3.org
Subject: Re: [ACTION-59] Introduce lookup by id structures for streams and  tracks.

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 15:49:54 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:35:49 UTC