lib/push/cordova.js
function onPushNotificationNotification(response) {
    // assignments avoiding changes of implementation state during promise chain
    var plugin = pushPlugin;
    var callback = pushCallback;
    return Q(response).then(function (r) {
        diag.debug.assert(r === response, 'just begins promise chain avoiding explicit try-catch');
        return callback(undefined, response) || response;
    }).then(function (r) {
        diag.debug.assert(r === response, 'push callback must respond same object');
        return Q.Promise(function (resolve, reject) {
            try {
                if ('notId' in response.additionalData) {
                    plugin.finish(resolve, reject, response.additionalData.notId);
                }
                else {
                    plugin.finish(resolve, reject);
                }
            }
            catch (error) {
                reject(error);
            }
        });
    }).done(undefined, function (error) {
        return Q(callback(error, response) || response).catch(function (e) {
            diag.debug.assert(e === error, 'push callback failed: ' + e.message);
            return response;
        });
    });
}
function onPushNotificationNotification(response) {
    // assignments avoiding changes of implementation state during promise chain
    var plugin = pushPlugin;
    var callback = pushCallback;
    return Q(response).then(function (r) {
        diag.debug.assert(r === response, 'just begins promise chain avoiding explicit try-catch');
        return callback(undefined, response) || response;
    }).then(function (r) {
        diag.debug.assert(r === response, 'push callback must respond same object');
        return Q.Promise(function (resolve, reject) {
            try {
                if ('notId' in response.additionalData) {
                    plugin.finish(resolve, reject, response.additionalData.notId);
                }
                else {
                    plugin.finish(resolve, reject);
                }
            }
            catch (error) {
                reject(error);
            }
        });
    }).done(undefined, function (error) {
        return Q(callback(error, response) || response).catch(function (e) {
            diag.debug.assert(e === error, 'push callback failed: ' + e.message);
            return response;
        });
    });
}
function onPushNotificationNotification ( response ) { // assignments avoiding changes of implementation state during promise chain var plugin = pushPlugin ; var callback = pushCallback ; return Q ( response ) . then ( function ( r ) { diag . debug . assert ( r === response , 'just begins promise chain avoiding explicit try-catch' ) ; return callback ( undefined , response ) || response ; } ) . then ( function ( r ) { diag . debug . assert ( r === response , 'push callback must respond same object' ) ; return Q . Promise ( function ( resolve , reject ) { try { if ( 'notId' in response . additionalData ) { plugin . finish ( resolve , reject , response . additionalData . notId ) ; } else { plugin . finish ( resolve , reject ) ; } } catch ( error ) { reject ( error ) ; } } ) ; } ) . done ( undefined , function ( error ) { return Q ( callback ( error , response ) || response ) . catch ( function ( e ) { diag . debug . assert ( e === error , 'push callback failed: ' + e . message ) ; return response ; } ) ; } ) ; }
executed on each incoming push notification message calling the pushCallback in an error-agnostic fashion.
executed on each incoming push notification message calling the pushCallback in an error - agnostic fashion .