首页 > TAG信息列表 > rej

宏任务和微任务

参考:https://www.jianshu.com/p/bcbf7894027c      示例 1:宏任务中包含微任务 (function() {     setTimeout(() => {         console.log(1)         new Promise((res, rej) => {             res()         }).then(() => console.log(2))      

【原创】Promise异步编程

  show me the code function getPromise(cbk){ return (new Promise(cbk)); } getPromise(function (res,rej) { res("suc1") //只会执行一个,并把参数传递到catch或者then rej("err1") }).catch(function(err){ console.log(err,1) }).then(function

【微信小程序】封装request请求模块/wx小程序手动封装Promise

// 封装请求模块 const Promise = require('./Promise.js'); const baseUrl = 'http://127.0.0.1:8080/'; function request(method, url, data) { return new Promise((res,rej) => { let header = { 'content-type': 'applicati