ipc-promise.js
function commonEventHandler(event, arg) {
    // NOTE: send from renderer process always.
    var successEventName = getSuccessEventName(arg.eventName, arg.id);
    var failureEventName = getFailureEventName(arg.eventName, arg.id);

    var onSuccess = function(result) {
      // send success to ipc for renderer process.
      event.sender.send(COMMON_SUCCESS_EVENT_NAME, {
        data: result,
        eventName: arg.eventName,
        id: arg.id
      });
      cee.removeListener(successEventName, onSuccess);
      cee.removeListener(failureEventName, onFailure);
    };
    var onFailure = function(result) {
      // send failure to ipc for renderer process.
      event.sender.send(COMMON_FAILURE_EVENT_NAME, {
        data: result,
        eventName: arg.eventName,
        id: arg.id
      });
      cee.removeListener(successEventName, onSuccess);
      cee.removeListener(failureEventName, onFailure);
    };

    // add listener to common event emitter for main process.
    cee.on(successEventName, onSuccess);
    cee.on(failureEventName, onFailure);

    // emit to common event emitter for main process.
    cee.emit(arg.eventName, arg.id, arg.data, event);
  }
function commonEventHandler(event, arg) {
    // NOTE: send from renderer process always.
    var successEventName = getSuccessEventName(arg.eventName, arg.id);
    var failureEventName = getFailureEventName(arg.eventName, arg.id);

    var onSuccess = function(result) {
      // send success to ipc for renderer process.
      event.sender.send(COMMON_SUCCESS_EVENT_NAME, {
        data: result,
        eventName: arg.eventName,
        id: arg.id
      });
      cee.removeListener(successEventName, onSuccess);
      cee.removeListener(failureEventName, onFailure);
    };
    var onFailure = function(result) {
      // send failure to ipc for renderer process.
      event.sender.send(COMMON_FAILURE_EVENT_NAME, {
        data: result,
        eventName: arg.eventName,
        id: arg.id
      });
      cee.removeListener(successEventName, onSuccess);
      cee.removeListener(failureEventName, onFailure);
    };

    // add listener to common event emitter for main process.
    cee.on(successEventName, onSuccess);
    cee.on(failureEventName, onFailure);

    // emit to common event emitter for main process.
    cee.emit(arg.eventName, arg.id, arg.data, event);
  }
function commonEventHandler ( event , arg ) { // NOTE: send from renderer process always. var successEventName = getSuccessEventName ( arg . eventName , arg . id ) ; var failureEventName = getFailureEventName ( arg . eventName , arg . id ) ; var onSuccess = function ( result ) { // send success to ipc for renderer process. event . sender . send ( COMMON_SUCCESS_EVENT_NAME , { data : result , eventName : arg . eventName , id : arg . id } ) ; cee . removeListener ( successEventName , onSuccess ) ; cee . removeListener ( failureEventName , onFailure ) ; } ; var onFailure = function ( result ) { // send failure to ipc for renderer process. event . sender . send ( COMMON_FAILURE_EVENT_NAME , { data : result , eventName : arg . eventName , id : arg . id } ) ; cee . removeListener ( successEventName , onSuccess ) ; cee . removeListener ( failureEventName , onFailure ) ; } ; // add listener to common event emitter for main process. cee . on ( successEventName , onSuccess ) ; cee . on ( failureEventName , onFailure ) ; // emit to common event emitter for main process. cee . emit ( arg . eventName , arg . id , arg . data , event ) ; }
common event handler for ipc.

@private
@param {Event} event event object.
@param {Object} arg argument object.
common event handler for ipc .