如何获取在另一个 javascript 函数中用作参数的匿名函数返回的值?
在下面的方法调用registerDevice
中,我想在该函数范围之外获取匿名函数的“状态”值。
pushNotification.registerDevice({alert:true, badge:true, sound:true}, function(status) {
// if successful status is an object that looks like this:
// {"type":"7","pushBadge":"1","pushSound":"1","enabled":"1","deviceToken":"blablahblah","pushAlert":"1"}
console.warn('registerDevice:%o', status);
});