微信小程序 worker

worker.onMessage(res => {
let aO=a();
worker.postMessage({
msg:"w33"+aO
})
});

async function a(){
return "0";
}

const requst = (url, data, method,token) => {
return new Promise((resolve, reject) => {
let param = {};
param["Content-Type"] = 'application/json';
param["authorization"] = token;
worker.request({
url: "https://cw.aer5.com"+url,
method: method,
data: data,
header: param,
success: (res) => {
if (res.statusCode == "200") {
resolve(res["data"]);
} else {
reject(res["data"]);
}
},
fail: (error) => {
reject({
"code": "network_err"
});
}
})

});

}

你可能感兴趣的:(微信小程序 worker)