Skip to content

Instantly share code, notes, and snippets.

@jamesplease
Last active March 30, 2018 21:22
Show Gist options
  • Save jamesplease/81cf2f2ce29b5fce7df3c24fe5d71c7a to your computer and use it in GitHub Desktop.
Save jamesplease/81cf2f2ce29b5fce7df3c24fe5d71c7a to your computer and use it in GitHub Desktop.
Future Fetcher API considerations
  • Built on top of the Fetch API
  • Split loading state into two Booleans (awaiting response and streaming)
  • cancellation API, even if it is just "ignoring" the response
  • API that maps to Promises. Likely a wrapper on top of the Response object
  • Partial success / partial failure (meaning one single response is returned with partial success. In other words, this is independent from streaming)
  • Streaming (could be multiple requests making up the stream under-the-hood, or just one that is piping data to you gradually, i.e. JSONS)
  • "Middleware" - could be a pattern rather than a library. It is just a pattern to transform data into useful formats. For instance, normalization middleware for inconsistent APIs.
  • Parallel requests: Promise.all()
  • Serial requests: someFetcher().then(() => {})
  • Fetchers could be bundled as a library
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment