<commit_before>// TODO: Optimize out lifecycle events if they are not defined
//       instead of doing runtime checks

var Alloy = require("alloy"), 
	_ = Alloy._, 
	A$ = Alloy.A, 
	M$ = Alloy.M, 
	BC$ = Alloy.Backbone.Collection,
	Lifecycle = {};

<%= CFG %>

<%= lifecycle %>

exports.create = function() {
	var L$ = {},
		root$;

	// TODO: Move this definition into a component object module to be included
	//       in the runtime alloy/components path
	var $ = {
		addEventListener: function(evt,callback) {
			if (!L$[evt]) {
				L$[evt] = [];
			}
			L$[evt].push(callback);
		},
		fireEvent: function(evt,object) {
			if (_.isArray(L$[evt])) {
				for (var i = 0, l = L$[evt].length; i < l; i++) {
					L$[evt][i](object);
				}
			}
		},
		removeEventListener: function(evt,callback) {
			if (_.isArray(L$[evt])) {
				Ti.API.info(L$[evt]);
				L$[evt] = _.without(L$[evt], callback);
				Ti.API.info(L$[evt]);
			}
		},
		setParent: function(parent) {
			if (root$) {
				parent.add(root$);
			} 
		}
	};

	if (_.isFunction(Lifecycle.beforeCreate)) {
		Lifecycle.beforeCreate($);
	}

	// generated from view markup
<%= viewCode %>

	// generated from controller
<%= controllerCode %>

	if (_.isFunction(Lifecycle.afterCreate)) {
		Lifecycle.afterCreate($);
	}

	return $;
};<commit_msg>expose the root of all components<commit_after>// TODO: Optimize out lifecycle events if they are not defined
//       instead of doing runtime checks

var Alloy = require("alloy"), 
	_ = Alloy._, 
	A$ = Alloy.A, 
	M$ = Alloy.M, 
	BC$ = Alloy.Backbone.Collection,
	Lifecycle = {};

<%= CFG %>

<%= lifecycle %>

exports.create = function() {
	var L$ = {},
		root$;

	// TODO: Move this definition into a component object module to be included
	//       in the runtime alloy/components path
	var $ = {
		addEventListener: function(evt,callback) {
			if (!L$[evt]) {
				L$[evt] = [];
			}
			L$[evt].push(callback);
		},
		fireEvent: function(evt,object) {
			if (_.isArray(L$[evt])) {
				for (var i = 0, l = L$[evt].length; i < l; i++) {
					L$[evt][i](object);
				}
			}
		},
		removeEventListener: function(evt,callback) {
			if (_.isArray(L$[evt])) {
				Ti.API.info(L$[evt]);
				L$[evt] = _.without(L$[evt], callback);
				Ti.API.info(L$[evt]);
			}
		},
		setParent: function(parent) {
			if (root$) {
				parent.add(root$);
			} 
		},
		getRoot: function() {
			return root$;
		}
	};

	if (_.isFunction(Lifecycle.beforeCreate)) {
		Lifecycle.beforeCreate($);
	}

	// generated from view markup
<%= viewCode %>

	// generated from controller
<%= controllerCode %>

	if (_.isFunction(Lifecycle.afterCreate)) {
		Lifecycle.afterCreate($);
	}

	return $;
};
{'fraction_non_alphanumeric': 0.18421052631578946, 'fraction_numerical': 0.0007518796992481203, 'mean_word_length': 3.02571860816944, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '211829', 'n_tokens_mistral': 1119, 'n_tokens_neox': 990, 'n_words': 213}