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.

-Anant

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