- From: Jonas Sicking <jonas@sicking.cc>
- Date: Fri, 17 May 2013 21:56:58 -0700
- To: Takeshi Yoshino <tyoshino@google.com>
- Cc: Anne van Kesteren <annevk@annevk.nl>, Feras Moussa <feras.moussa@hotmail.com>, Travis Leithead <travis.leithead@microsoft.com>, Alex Russell <slightlyoff@google.com>, "Web Applications Working Group WG (public-webapps@w3.org)" <public-webapps@w3.org>
On Fri, May 17, 2013 at 9:38 PM, Jonas Sicking <jonas@sicking.cc> wrote: > For Stream reading, I think I would do something like the following: > > interface Stream { > AbortableProgressFuture<ArrayBuffer> readBinary(optional unsigned > long long size); > AbortableProgressFuture<String> readText(optional unsigned long long > size, optional DOMString encoding); > AbortableProgressFuture<Blob> readBlob(optional unsigned long long size); > > ChunkedData readBinaryChunked(optional unsigned long long size); > ChunkedData readTextChunked(optional unsigned long long size); > }; > > interface ChunkedData : EventTarget { > attribute EventHandler ondata; > attribute EventHandler onload; > attribute EventHandler onerror; > }; Actually, we could even get rid of the ChunkedData interface and do something like interface Stream { AbortableProgressFuture<ArrayBuffer> readBinary(optional unsigned long long size); AbortableProgressFuture<String> readText(optional unsigned long long size, optional DOMString encoding); AbortableProgressFuture<Blob> readBlob(optional unsigned long long size); AbortableProgressFuture<void> readBinaryChunked(optional unsigned long long size); AbortableProgressFuture<void> readTextChunked(optional unsigned long long size); }; where the ProgressFutures returned from readBinaryChunked/readBinaryChunked delivers the data in the progress notifications only, and no data is delivered when the future is actually resolved. Though this might be abusing Futures a bit? / Jonas
Received on Saturday, 18 May 2013 04:58:00 UTC