📜  在 js 中最终承诺 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:10.677000             🧑  作者: Mango

代码示例1
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; });