Javascript 我的APN函数能够从Node.js应用程序发送通知,但回调没有显示任何引用

Javascript 我的APN函数能够从Node.js应用程序发送通知,但回调没有显示任何引用,javascript,node.js,apple-push-notifications,Javascript,Node.js,Apple Push Notifications,如何从API函数获取回调,以便将其转发到API? 当我使用callback()时,我只是一个JavaScript新手。它是 显示callback()不是一个函数 function sendiosNotification(notification,callback){ if(!notification.data.to){ return callback({error : false, message : "receiver's deviceid is not availa

如何从API函数获取回调,以便将其转发到API? 当我使用
callback()
时,我只是一个JavaScript新手。它是 显示
callback()
不是一个函数

function sendiosNotification(notification,callback){

    if(!notification.data.to){
        return callback({error : false, message : "receiver's deviceid is not available. could not send notificaion"});
    }
    var client = new apns.Provider({
        cert:"./cert/cert.pem",
        key:"./cert/key.pem",
        production: true,

    });
    var notifi = new apns.Notification();
    notifi.topic = "---"
    notifi.alert = notification.data.message;
    notifi.title = notification.data.username;
    device_token = notification.data.to;     
    client.send(notifi,device_token).then(result =>{
        console.log(result);
        callback()
    });
}
数据
来自我的API。我可以成功地向我的设备发送通知,但该功能不返回任何响应

在我的API中使用
sendios
函数

sendiosNotification({ data : data })
如何使用响应或回调将通知响应发送回API?

这应该可以-

sendiosNotification({ data : data }, function(){
      console.log('callback called');
});

回调函数的工作原理

function i(num,cb){console.log(num), cb()};

i(1,function(){console.log("finish")})
输出:

1
finish

如何将回调传递给sendiosNotification函数?Passon回调作为响应。如果你能帮我的话,这就是我的代码,而这段代码可能会解决这个问题,真的有助于提高你文章的质量。请记住,您将在将来回答读者的问题,这些人可能不知道您的代码建议的原因。