packages/okam-helper/lib/event.js
function handleProxyEvent(source, target, eventName, options) {
    let {newEventName, prependSourceArg} = options || {};

    source.on(eventName, function (...args) {
        prependSourceArg && args.unshift(source);

        if (typeof newEventName === 'function') {
            newEventName.apply(target, args);
        }
        else {
            newEventName || (newEventName = eventName);
            args.unshift(newEventName);
            target.emit.apply(target, args);
        }
    });
}
function handleProxyEvent(source, target, eventName, options) {
    let {newEventName, prependSourceArg} = options || {};

    source.on(eventName, function (...args) {
        prependSourceArg && args.unshift(source);

        if (typeof newEventName === 'function') {
            newEventName.apply(target, args);
        }
        else {
            newEventName || (newEventName = eventName);
            args.unshift(newEventName);
            target.emit.apply(target, args);
        }
    });
}
function handleProxyEvent ( source , target , eventName , options ) { let { newEventName , prependSourceArg } = options || { } ; source . on ( eventName , function ( ... args ) { prependSourceArg && args . unshift ( source ) ; if ( typeof newEventName === 'function' ) { newEventName . apply ( target , args ) ; } else { newEventName || ( newEventName = eventName ) ; args . unshift ( newEventName ) ; target . emit . apply ( target , args ) ; } } ) ; }
Handle the event proxy

@inner
@param {EventEmitter} source the event trigger source
@param {EventEmitter} target the proxy target
@param {string} eventName the proxy event name
@param {Object=} options the proxy options
@param {string|Function=} options.newEventName the new event name to trigger
or default event handler
@param {boolean=} options.prependSourceArg whether prepend the original event
trigger to event handler argument list. By default, false.
Handle the event proxy