• EventEmitterMixin(TargetClass: ConstructorOf<any, any>): typeof NativeEmitter
  • This function adds core eventemitter functionality to the targeted class. It modifies the class and the instance.

    • It adds Events list as Class.Events as static variable
    • It mixins the eventEmitter class if not inherited
    • It adds relevant inheritance to the class if there is a parent class
    • It alters the 'on' method relevant with inheritance

    Example

    // viewGroup-Android.js
    const Events = { ...View.Events, ...EventList }; // Inherit the Parent Events
    const EventFunctions = {
    [EventsList.ViewAdded]: function() {
    this.onViewAdded = EventEmitterWrapper(this, EventList.ViewAdded, null);
    }
    }

    function ViewGroup() {
    function emitterCallBack() {
    if (!this.didSetHierarchyChangeListener) {
    setHierarchyChangeListener(this);
    }
    }
    EventEmitterCreator(this, EventFunctions, emitterCallBack.bind(this));
    }

    Parameters

    • TargetClass: ConstructorOf<any, any>

    Returns typeof NativeEmitter

Generated using TypeDoc