- From: Benjamin Goering <notifications@github.com>
- Date: Thu, 10 Dec 2015 09:49:53 -0800
- To: w3c/findtext <findtext@noreply.github.com>
Received on Thursday, 10 December 2015 17:50:41 UTC
Promises are great for asynchronously getting a single future result. It sounds like you want to leave the option open for 'search' to stream many results over time. In that case Promises are probably not so good. EventTarget is a decent interface. ```javascript var results = whatever.search('...') results.addEventListener('result', function (result) {}); ``` or whatever.search('...').forEach(function (result) {}); Generators are appropriate too, but futuristic. You could also make it an iterator of promises. More theory: >From https://github.com/kriskowal/gtor | | **Singular** | **Plural** | | :----------: | :------------------: | :---------------------: | | **Spatial** | Value | Iterable<Value> | | **Temporal** | Promise<Value> | Observable<Value> | --- Reply to this email directly or view it on GitHub: https://github.com/w3c/findtext/issues/19#issuecomment-163700950
Received on Thursday, 10 December 2015 17:50:41 UTC