lib/application.js
function callMessageHandler(instance, name, data) {

		// If onmessage is an object call message handler with the matching key (if any)
		if (instance.onmessage !== null && typeof instance.onmessage === 'object' && instance.onmessage.hasOwnProperty(name)) {
			instance.onmessage[name].call(instance, data);

		// Otherwise if message name exists in messages call onmessage with name, data
		} else if (indexOf(instance.messages || [], name) !== -1) {
			instance.onmessage.call(instance, name, data);
		}
	}
function callMessageHandler(instance, name, data) {

		// If onmessage is an object call message handler with the matching key (if any)
		if (instance.onmessage !== null && typeof instance.onmessage === 'object' && instance.onmessage.hasOwnProperty(name)) {
			instance.onmessage[name].call(instance, data);

		// Otherwise if message name exists in messages call onmessage with name, data
		} else if (indexOf(instance.messages || [], name) !== -1) {
			instance.onmessage.call(instance, name, data);
		}
	}
function callMessageHandler ( instance , name , data ) { // If onmessage is an object call message handler with the matching key (if any) if ( instance . onmessage !== null && typeof instance . onmessage === 'object' && instance . onmessage . hasOwnProperty ( name ) ) { instance . onmessage [ name ] . call ( instance , data ) ; // Otherwise if message name exists in messages call onmessage with name, data } else if ( indexOf ( instance . messages || [ ] , name ) !== - 1 ) { instance . onmessage . call ( instance , name , data ) ; } }
Gets message handlers from the provided module instance
@param {Box.Application~ModuleInstance|Box.Application~BehaviorInstance} instance Messages handlers will be retrieved from the Instance object
@param {String} name The name of the message to be handled
@param {Any} data A playload to be passed to the message handler
@returns {void}
@private
Gets message handlers from the provided module instance