美文网首页
微信小程序 worker

微信小程序 worker

作者: 亦久亦韭 | 来源:发表于2022-09-10 15:09 被阅读0次

    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

          本文链接:https://www.haomeiwen.com/subject/udytortx.html