dist/f2.basic.js
function(token, eventKey) // additional arguments will likely be passed
		{			
			// will throw an exception and stop execution if the token is invalid
			if(token != _f2t)
			{
				throw ('Token passed is invalid. Only F2 is allowed to call F2.AppHandlers.__trigger().');
			}
			
			if(_handlerCollection && _handlerCollection[eventKey])
			{				
				// create a collection of arguments that are safe to pass to the callback.
				var passableArgs = [];
				
				// populate that collection with all arguments except token and eventKey
				for(var i = 2, j = arguments.length; i < j; i++)
				{
					passableArgs.push(arguments[i]);
				}
				
				if(_handlerCollection[eventKey].length === 0 && _defaultMethods[eventKey])
				{
					_defaultMethods[eventKey].apply(F2, passableArgs);
					return this;
				}
				else if(_handlerCollection[eventKey].length === 0 && !_handlerCollection[eventKey])
				{
					return this;
				}
				
				// fire all event listeners in the order that they were added.
				for(var iCounter = 0, hcl = _handlerCollection[eventKey].length; iCounter < hcl; iCounter++)
				{
					var handler = _handlerCollection[eventKey][iCounter];
					
					// appRender where root is already defined
					if (handler.domNode && arguments[2] && arguments[2].root && arguments[3])
					{
						var $appRoot = jQuery(arguments[2].root).append(arguments[3]);
						jQuery(handler.domNode).append($appRoot);
					}
					else if (handler.domNode && arguments[2] && !arguments[2].root && arguments[3])
					{
						// set the root to the actual HTML of the app
						arguments[2].root = jQuery(arguments[3]).get(0);
						// appends the root to the dom node specified
						jQuery(handler.domNode).append(arguments[2].root);
					}
					else
					{
						handler.func.apply(F2, passableArgs);
					}
				}
			}
			else
			{
				throw ('Invalid EventKey passed. Check your inputs and try again.');
			}
			
			return this;
		}
function(token, eventKey) // additional arguments will likely be passed
		{			
			// will throw an exception and stop execution if the token is invalid
			if(token != _f2t)
			{
				throw ('Token passed is invalid. Only F2 is allowed to call F2.AppHandlers.__trigger().');
			}
			
			if(_handlerCollection && _handlerCollection[eventKey])
			{				
				// create a collection of arguments that are safe to pass to the callback.
				var passableArgs = [];
				
				// populate that collection with all arguments except token and eventKey
				for(var i = 2, j = arguments.length; i < j; i++)
				{
					passableArgs.push(arguments[i]);
				}
				
				if(_handlerCollection[eventKey].length === 0 && _defaultMethods[eventKey])
				{
					_defaultMethods[eventKey].apply(F2, passableArgs);
					return this;
				}
				else if(_handlerCollection[eventKey].length === 0 && !_handlerCollection[eventKey])
				{
					return this;
				}
				
				// fire all event listeners in the order that they were added.
				for(var iCounter = 0, hcl = _handlerCollection[eventKey].length; iCounter < hcl; iCounter++)
				{
					var handler = _handlerCollection[eventKey][iCounter];
					
					// appRender where root is already defined
					if (handler.domNode && arguments[2] && arguments[2].root && arguments[3])
					{
						var $appRoot = jQuery(arguments[2].root).append(arguments[3]);
						jQuery(handler.domNode).append($appRoot);
					}
					else if (handler.domNode && arguments[2] && !arguments[2].root && arguments[3])
					{
						// set the root to the actual HTML of the app
						arguments[2].root = jQuery(arguments[3]).get(0);
						// appends the root to the dom node specified
						jQuery(handler.domNode).append(arguments[2].root);
					}
					else
					{
						handler.func.apply(F2, passableArgs);
					}
				}
			}
			else
			{
				throw ('Invalid EventKey passed. Check your inputs and try again.');
			}
			
			return this;
		}
function ( token , eventKey ) // additional arguments will likely be passed { // will throw an exception and stop execution if the token is invalid if ( token != _f2t ) { throw ( 'Token passed is invalid. Only F2 is allowed to call F2.AppHandlers.__trigger().' ) ; } if ( _handlerCollection && _handlerCollection [ eventKey ] ) { // create a collection of arguments that are safe to pass to the callback. var passableArgs = [ ] ; // populate that collection with all arguments except token and eventKey for ( var i = 2 , j = arguments . length ; i < j ; i ++ ) { passableArgs . push ( arguments [ i ] ) ; } if ( _handlerCollection [ eventKey ] . length === 0 && _defaultMethods [ eventKey ] ) { _defaultMethods [ eventKey ] . apply ( F2 , passableArgs ) ; return this ; } else if ( _handlerCollection [ eventKey ] . length === 0 && ! _handlerCollection [ eventKey ] ) { return this ; } // fire all event listeners in the order that they were added. for ( var iCounter = 0 , hcl = _handlerCollection [ eventKey ] . length ; iCounter < hcl ; iCounter ++ ) { var handler = _handlerCollection [ eventKey ] [ iCounter ] ; // appRender where root is already defined if ( handler . domNode && arguments [ 2 ] && arguments [ 2 ] . root && arguments [ 3 ] ) { var $appRoot = jQuery ( arguments [ 2 ] . root ) . append ( arguments [ 3 ] ) ; jQuery ( handler . domNode ) . append ( $appRoot ) ; } else if ( handler . domNode && arguments [ 2 ] && ! arguments [ 2 ] . root && arguments [ 3 ] ) { // set the root to the actual HTML of the app arguments [ 2 ] . root = jQuery ( arguments [ 3 ] ) . get ( 0 ) ; // appends the root to the dom node specified jQuery ( handler . domNode ) . append ( arguments [ 2 ] . root ) ; } else { handler . func . apply ( F2 , passableArgs ) ; } } } else { throw ( 'Invalid EventKey passed. Check your inputs and try again.' ) ; } return this ; }
Allows F2 to trigger specific events internally.
@method __trigger
@private
@chainable
@param {String} token The token received from {{#crossLink "F2.AppHandlers/\_\_f2GetToken:method"}}{{/crossLink}}.
@param {String} eventKey The event to fire. The complete list of event keys is available in {{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.
Allows F2 to trigger specific events internally .