Example #1
0
File: ui.js Project: AlAloul/UTiL
	$button.addEventListenerSingle = function (func) {
		if (!_.isFunction(func)) {
			Ti.API.error("[XP.UI Button] ERROR: Click handler must be a function");
			return;
		}
		$button.addEventListener('click', function (e) {
			if (!e.source.executed) {
				e.source.executed = true;
				// run once call stack is cleared
				_.defer(function () {
					func(e);
					e.source.executed = false;
				});
			}

		});
	};
Example #2
0
File: ui.js Project: AlAloul/UTiL
	$button.addEventListenerOnce = function (eventName, func) {
		var triggered = false;
		if (!_.isFunction(func)) {
			Ti.API.error("[XP.UI Button] ERROR: Single Event Listener callback must be a function");
			return;
		}

		function singularCallback(e) {
			if (!triggered) {
				triggered = true;
				// run once call stack is cleared
				_.defer(function () {
					func(e);
					$button.removeEventListener(eventName, singularCallback);
				});
			}
		}
		$button.addEventListener(eventName, singularCallback);
	};
Example #3
0
 success: function(migration, callback) {
   if (options && Utils._.isFunction(options.success)) {
     options.success.call(self, migration);
   }
   callback();
 }
Example #4
0
 after: function(migration) {
   if (options && Utils._.isFunction(options.after)) {
     options.after.call(self, migration);
   }
 },
Example #5
0
 before: function(migration) {
   if (options && Utils._.isFunction(options.before)) {
     options.before.call(self, migration);
   }
 },