- From: Benjamin Goering via GitHub <sysbot+gh@w3.org>
- Date: Thu, 10 Dec 2015 17:49:53 +0000
- To: public-annotation@w3.org
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> | -- GitHub Notification of comment by gobengo Please view or discuss this issue at https://github.com/w3c/findtext/issues/19#issuecomment-163700950 using your GitHub account
Received on Thursday, 10 December 2015 17:49:55 UTC