Answers for "promise finally in js"

0

promise finally in js

let isLoading = true;

fetch(myRequest)
  .then(function(json) { /* process your JSON further */ })
  .catch(function(error) { console.error(error); /* this line can also throw, e.g. when console = {} */ })
  .finally(function() { isLoading = false; });
Posted by: Guest on July-28-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language