why is that? void forEach(mapCB);
if that's to make it consistent with Array#forEach you should accept the context argument in both map and forEach too? However, I don't get why this should not work: str.forEach(callback).then(notify); Said that, I think is quite good after some renaming, but probably you need to write some more concrete example? P.S. had already thoughts about a possible $(obj).on('loadStatus', updateLoadingUI); ^__^ naaaaa, just kidding On Tue, Apr 16, 2013 at 4:38 PM, Tab Atkins Jr. <jackalm...@gmail.com>wrote: > Condensing my suggestions for additional variants into one small post: > > * EventStream is an abstraction to represent streams of events as a > first-class value. It's lossy, and forgets about its history. > (Though we probably want a switch allowing it to at least remember its > history before the first listener is attached.) It's multi-listener. > This will be used for event-like interfaces that don't need the > complexity of DOM Events (because they're not tree-based). I think we > should also allow a way to extract an EventStream from *any* > element/event pair - the stream is updated whenever an event > successfully reaches the element without being cancelled by an > ancestor. > > * UpdateStream is an EventStream specifically focused on watching > updates of some given value. When you add a new listener, the stream > replays its most recent update to the new listener. It adds a > .value() function, which is identical to .next() but also gets the > most recent update replayed first. It's multi-listener, and probably > also wants the remember-initial-history switch.) This is intended for > something like my proposal for "UpdateStream.watch(object, property)", > which turns *any* JS property into an event stream of value changes. > (This can be built on top of Object.observe, so there's nothing > fundamentally new there.) > > * ValueStream is a single-listener non-lossy stream. Only one > .listen() callback can be active at a time; trying to call .listen() > again before the first is unlistened throws an error. If there's no > listener, .next() can be used to pull values out of the stream in > succession without loss. Successive calls to .next() return successive > values from the stream. (This is unlike EventStream, where multiple > .next() calls in the same tick will return equivalent futures for > whatever the very next value is.) This is intended for a lot of > general use-cases, like pulling tokens out of a token stream. > > Have I missed any major use-cases? > > ~TJ > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss