nl_tokens: ### on * ( [ object ] event callback ) * Register a function to get called when a certain event is published . Any event handlers attached after an event has been triggered at least once will immediately be called with the most recently triggered value .
pl_tokens: function ( obj , event , callback ) { // Use jQuery to handle DOM events. if ( underscore . isElement ( obj ) && $ ) { return $ ( obj ) . on ( event , callback ) ; } // Use internal handler for pubsub if ( this . isString ( obj ) ) { callback = event ; event = obj ; obj = this ; } // Ensure a container is available for all events. if ( ! this . isObject ( obj . __event_handlers ) ) { obj . __event_handlers = { } ; } // Ensure a handler is available for this particular event. if ( ! ( event in obj . __event_handlers ) ) { // Using a memory callback obj . __event_handlers [ event ] = underscore . Callbacks ( "memory" ) ; } obj . __event_handlers [ <mask> ] . add ( callback ) ; return this ; }