Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js recursive fetch

var doRecursiveRequest = (url, limit = Number.MAX_VALUE) => 
  fetch(url).then(res => {
    if (res.status !== 200 && --limit) {
      return doRecursiveRequest(url, limit);
    } 
    return res.json();
  });

doRecursiveRequest('someURLWithAJSONfile/file.json', 10)
  .then(data => console.log(data))
  .catch(error => console.log(error));
Comment

PREVIOUS NEXT
Code Example
Javascript :: reportValidity 
Javascript :: regex match between quotes without escape 
Javascript :: create index mongodb 
Javascript :: update array usestate 
Javascript :: transition css with js 
Javascript :: responsive font size react native 
Javascript :: camel case first javascript 
Javascript :: Variadic function in javascript 
Javascript :: Invalid prettier configuration file detected. See log for details. 
Javascript :: js fit window to content 
Javascript :: how to convert json to javascript object 
Javascript :: how to check if a letter is capital in javascript 
Javascript :: [Object] node js output 
Javascript :: jquery on method 
Javascript :: parse string javascript 
Javascript :: replit node version 
Javascript :: When JavaScript was invented month?* 
Javascript :: jquery replace attribute 
Javascript :: how to adjust brightness with a slider in javascript 
Javascript :: express-jwt 
Javascript :: javascript this Inside Function with Strict Mode 
Javascript :: flask sqlalchemy json 
Javascript :: perfect scrollbar jquery 
Javascript :: vue state 
Javascript :: javascript undefined 
Javascript :: jquery get label text only for input 
Javascript :: JavaScript catch() method 
Javascript :: get location 
Javascript :: node.js http server 
Javascript :: how to upload picture on canvas in react 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =