我有以下代码将我的 iOS 设备注册到我的 APNS 服务器:
pushNotification.registerDevice({
    alert: true,
    badge: true,
    sound: true,
    pw_appid: "***",
    appname: "***"
},
function (status) {
    var deviceToken = status['deviceToken'];
},
function (status) {
    console.warn('failed to register : ' + JSON.stringify(status));
    navigator.notification.alert(JSON.stringify(['failed to register ', status]));
});
这运行onLoad,但我需要访问deviceToken的范围之外pushNotification.registerDevice() function (status)。
在这种情况下,是否有可能访问deviceToken函数内部的函数内部,函数外部的函数?
我想我可以通过使用将其设为全局变量,window.deviceToken然后稍后调用它,但它返回未定义。