fetch with Timeout / / No Comments A few years back I wrote a blog post about how write a fetch Promise that times out. The function was effective but the code wasn’t great, mostly because AbortController , which allows you to cancel a fetch Promise, did not yet exist. With AbortController and AbortSignal available, let’s create a better JavaScript function for fetching with a timeout: Much like the original function, we’ll use setTimeout to time to the cancellation but we’ll use the signal with the fetch request: async function fetchWithTimeout(url, opts = {}, timeout = 5000) { // Create the AbortController instance, get AbortSignal const abortController = new AbortController(); const { signal }... more → Posted in: JavaScript Tagged with: fetch, Timeout
Netflix builds JavaScript library to fetch data – InfoWorld / / No Comments InfoWorld Netflix builds JavaScript library to fetch dataInfoWorldWith its Falcor project, Netflix is offering a JavaScript library for efficient data-fetching, with developers able to represent remote data sources as a single domain model via the JSON Graph convention. Netflix, which uses Falcor for the company's …and more » JavaScript – Google News… more → Posted in: JavaScript Tagged with: builds, data, fetch, InfoWorld, JavaScript, library, Netflix