docs: function listenPushNotification(callback) {
      if (callback === void 0) { callback = defaultPushCallback; }
      if (resolveRegistrationEventResponse) {
          diag.debug.assert(!!rejectRegistrationEventResponse);
          resolveRegistrationEventResponse(undefined);
          resolveRegistrationEventResponse = undefined;
          rejectRegistrationEventResponse = undefined;
      }
      if (callback) {
          // perform registration
          promiseRegistrationEventResponse = device.ready.then(function (info) {
              var pushInitOptions = init.initOptions.push;
              var pushPlatform = info.platform.id;
              if (pushPlatform === 'windowsphone') {
                  pushPlatform = 'windows';
              }
              if (!pushInitOptions || !pushPlatform || !(pushPlatform in pushInitOptions)) {
                  // no push configuration for current platform
                  promiseRegistrationEventResponse = Q.resolve(undefined);
                  return promiseRegistrationEventResponse;
              }
              // init or reinit push
              var pushStatic = global['PushNotification'];
              var pushImpl = pushStatic.init(pushInitOptions);
              if (pushPlugin !== pushImpl) {
                  if (pushPlugin) {
                      // turn off existing event handlers (in reverse order of registration)
                      pushPlugin.off('notification', onPushNotificationNotification);
                      pushPlugin.off('registration', onPushNotificationRegistration);
                      pushPlugin.off('error', onPushNotificationError);
                  }
                  // set up new registration results
                  promiseRegistrationEventResponse = Q.Promise(function (resolve, reject) {
                      resolveRegistrationEventResponse = resolve;
                      rejectRegistrationEventResponse = reject;
                  });
                  // activation of new implementation
                  pushCallback = callback;
                  pushPlugin = pushImpl;
                  // turn on event handlers (in order of relevance)
                  pushPlugin.on('error', onPushNotificationError);
                  pushPlugin.on('registration', onPushNotificationRegistration);
                  pushPlugin.on('notification', onPushNotificationNotification);
              }
              return promiseRegistrationEventResponse;
          });
      }
      else if (pushPlugin) {
          // perform unregistration
          promiseRegistrationEventResponse = Q.Promise(function (resolve, reject) {
              try {
                  pushPlugin.unregister(resolve, reject);
              }
              catch (error) {
                  reject(error);
              }
          });
      }
      else {
          // nothing to unregister
          promiseRegistrationEventResponse = Q.resolve(undefined);
      }
      return promiseRegistrationEventResponse;
  }