Skip to content

Instantly share code, notes, and snippets.

@Raynos
Created July 11, 2014 20:50
Show Gist options
  • Save Raynos/10c55f51041d0de06227 to your computer and use it in GitHub Desktop.
Save Raynos/10c55f51041d0de06227 to your computer and use it in GitHub Desktop.
(*
next(cb).
- Calls cb(Error) if error
- Calls cb(null, value) if value
- Calls cb(null, undefined) if finished
end(cb)
- Aborts the underlying stream
- calls cb() once cleaned up
A stream is a ordered sequence of
- zero or more Data followed by Error or Finished
*)
type AsyncIterator := {
next: ((Error | null, Any | undefined) => void) => void,
end: (() => void) => void
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment