jm.event - JavaScript Events


    jm.event is a JavaScript extension that implements an event-listener-system across all [js] / [jsui] objects. Callback functions can be registered to specific events and remotely triggered by "firing" the related event. Listeners can be activated and deactivated and data can be passed to the listeners.
    Another way of describing events: It's similar to the [send] / [receive] object pairs, just within JavaScript.
    It is a notification system between [js] / [jsui] objects. It works in Max across patchers/subpatchers and in MaxForLive across different devices.
    For a full reference check the included jm.event_README file.
    For a usage examples take a look at the included example project.
    Adding a listener to an event:
    var myListenerId = jm.event.addListener(
      {
        eventName : “myEventName”,
        listener : function(event) {},    // Callback function
        eventId: myListenerId
      }
    );
    Firing an event:
    jm.event.fire(
      {
        eventName : “myEventName”,
        eventData : [“foo”, “bar”, “baz”]     // Any data to be send to the listener
        }
    );