On Fri, Jun 19, 2015 at 3:03 PM, Benjamin Kelly <bke...@mozilla.com> wrote:

> You could also use ReadableStream, but it doesn't look as similar to
> observables:
>
>   var reader = data.getStream().getReader();
>   reader.read().then(function handleRead(value) {
>     handleNext(value);
>     return reader.read().then(handleRead);
>   }).catch(handleError);
>
>   reader.closed.then(handleComplete);
>

Sorry, this one is probably better written with the
ReadStream-to-WritableStream adapter function pipeTo():

 data..getStream().pipeTo(new WritableStream({
    write: handleNext,
    close: handleComplete,
    abort: handleError
  }));
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to