Skip to content

Instantly share code, notes, and snippets.

@vsavkin
Created May 24, 2013 16:03
Show Gist options
  • Save vsavkin/5644537 to your computer and use it in GitHub Desktop.
Save vsavkin/5644537 to your computer and use it in GitHub Desktop.
class Latest<T> extends StreamEventTransformer<Stream<T>, T> {
StreamSubscription latest;
void handleData(Stream<T> stream, EventSink<T> sink) {
if(latest != null){
latest.cancel();
}
latest = stream.listen(sink.add);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment