[[Resolve]] (promise, x) if x is Promise, make promise accept the state of x. Note 4: if x is in waiting state, promise shall remain in waiting state until x is executed or rejected if x is in execution state, execute promise if x is in reject st...
function pro(){ return new Promise(resolve=>{ resolve() }) } function a(){ return pro().then(res=>{ setTimeout(()=>{ console.log(1) },2000) }) } function b(){ return pro().then(res=>{ ...
xnatInstance.get(`http: 10.2.10.106:5199 mri predict?pid=${patientName}`).then((respose)=> { console.log(respose.data.msg); instance.datas=respose.data.msg; });...
The response.data returned by axios can be used, but why is there another layer of promise? on the outside? Isn t it more troublesome to write like this when using ? The question I encountered yesterday just saw a person ask the same question, but th...
in a normal click event method, a promise object is called. Is return the promise object itself or its result? <Button @click="javaCodeSubmit">< Button> javaCodeSubmit(){ return genJavaCode() .then(res => { ...
< H1 > Code < H1 > undefined (node:5784) UnhandledPromiseRejectionWarning: TypeError: Cannot read property name of undefined at say (D: NodeJS Test test2.js:18:22) ...
how to get the requested url? in promise.all Is that okay? ...
MessageBox() .then(() => { console.log(1) }).catch(() => { console.log(2) }) MessageBox () is a pop-up window method encapsulated by elementUI. The pop-up window method contains a confirm and cancel button. Make sure to g...
I would like to ask if there is any way to turn asynchronism into Synchronize, similar to ajax in jquery ; similar to this function getData(){ var dataList; $.ajax({ async:false, .... success:function(data){ ...
const getData=function(url){ const pro=new Promise((resolve,reject)=>{ HTTP.call( GET ,url,{auth:"admin:admin"},(error,result)=>{ if(error){ reject(error); }else{ ...
function _getProductType (arr, num, str) { let type = arr.forEach(val => { if (num == val.code_val) { eslint-disable-line type = val.code_desc } else if (num == 1000 ) { eslint-disable-line type = } }) ...
I tried to encapsulate it, but it didn t work. It was embarrassing. has it been encapsulated by a boss? Ask for a code to learn, hard work you sent down, thank you! by the way, you need an encapsulated call like async await ...
suppose there is a method to get data in methods getData the data parameter returned by receiving is resultData mounted this this.getData().then(response => { let result = response.data this this.resultData = result }) my questi...
< H2 > problem description < H2 > now there is a scenario: I need to send data requests for four channels, that is, after requesting channel 1, some data will be put into the variable map- > 1, and there is no data to empty the data to the variable ma...
problem description in the process of using JavaScript to develop Mini Program, there are already many wrapper libraries that convert the original Mini Program API interface into a promise-based wrapper library, so is there such a library in the TypeS...
the third-party js, I called has several methods to execute promise, as follows: function init(){ a(); b(); c(); .... ... } function a(){ var q = [x,y]; promise Promise.all(q).then(function(arr){ ..... ...
problem description Mini Program s backend is written in Koa, and the registerTraining () function in trainingController is called in the training.js for routing. The whole process is to determine the user location information in the request paramete...
The code is as follows: how can I capture the reject? of any previous task in the tail catch var task1 = new Promise(function(resolve, reject){ resolve( success ); }); var task2 = new Promise(function(resolve, reject){ reject( error ); }); t...
the second interface uses the data returned by the first interface name , and then splices it without promise.all or global variables. Solve? function ajax(url,datas){ return new Promise((resolve,reject) => { $.ajax({...
encountered an interview question, usually after an asynchronous operation error will enter. Catch (), now has to enter after three errors, how to achieve this. ...