How to use titanium - 10 common examples

To help you get started, we’ve selected a few titanium examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tonylukasavage / ti-mocha / src / titanium.js View on Github external
console[type] = function() {
		var util = require('titanium/util'),
			args = Array.prototype.slice.call(arguments, 0),
			rawArgs = args.slice(0),
			isStudio = /\-studio$/.test(mocha._ti_reporter);

		if (!mocha._ti_quiet) {
			if (args.length === 0) {
				if (isStudio) {
					args.push(util.cursor.reset + ' ' + util.cursor.reset);
				} else {
					args.push(util.cursor.resetLine);
				}
			} else {
				var prefix = util.cursor.resetLine;
				if (!isStudio) {
					// Clear the existing line of text using ANSI codes, get rid of those pesky [INFO] prefixes
					args[0] = prefix + (args[0] || '').toString().split(/(?:\r\n|\n|\r)/).join('\n' + prefix);
				}
			}

			// Use the util.js format() port to get node.js-like console functions
			Ti.API.log(type === 'log' ? 'info' : type, util.format.apply(this, args));
		}

		// If the output file exists, write the content to the file as well
		if (mocha._ti_output_file) {
			mocha._ti_output_file.append(util.format.apply(this, rawArgs).replace(/\x1B\[[0-9;]*[a-zA-Z]/g, ''));
github tonylukasavage / ti-mocha / src / titanium.js View on Github external
console[type] = function() {
		var util = require('titanium/util'),
			args = Array.prototype.slice.call(arguments, 0),
			rawArgs = args.slice(0),
			isStudio = /\-studio$/.test(mocha._ti_reporter);

		if (!mocha._ti_quiet) {
			if (args.length === 0) {
				if (isStudio) {
					args.push(util.cursor.reset + ' ' + util.cursor.reset);
				} else {
					args.push(util.cursor.resetLine);
				}
			} else {
				var prefix = util.cursor.resetLine;
				if (!isStudio) {
					// Clear the existing line of text using ANSI codes, get rid of those pesky [INFO] prefixes
					args[0] = prefix + (args[0] || '').toString().split(/(?:\r\n|\n|\r)/).join('\n' + prefix);
				}
			}

			// Use the util.js format() port to get node.js-like console functions
			Ti.API.log(type === 'log' ? 'info' : type, util.format.apply(this, args));
		}

		// If the output file exists, write the content to the file as well
github tonylukasavage / ti-mocha / src / titanium.js View on Github external
if (args.length === 0) {
				if (isStudio) {
					args.push(util.cursor.reset + ' ' + util.cursor.reset);
				} else {
					args.push(util.cursor.resetLine);
				}
			} else {
				var prefix = util.cursor.resetLine;
				if (!isStudio) {
					// Clear the existing line of text using ANSI codes, get rid of those pesky [INFO] prefixes
					args[0] = prefix + (args[0] || '').toString().split(/(?:\r\n|\n|\r)/).join('\n' + prefix);
				}
			}

			// Use the util.js format() port to get node.js-like console functions
			Ti.API.log(type === 'log' ? 'info' : type, util.format.apply(this, args));
		}

		// If the output file exists, write the content to the file as well
		if (mocha._ti_output_file) {
			mocha._ti_output_file.append(util.format.apply(this, rawArgs).replace(/\x1B\[[0-9;]*[a-zA-Z]/g, ''));
		}
	};
}
github tonylukasavage / ti-mocha / src / reporters / ti-json.js View on Github external
runner.on('end', function(){
    var obj = {
      stats: self.stats,
      tests: tests.map(clean),
      failures: failures.map(clean),
      passes: passes.map(clean)
    };

    console.log(cursor.resetLine + JSON.stringify(obj, null, 2));
    runner.results = obj;
  });
}
github tonylukasavage / ti-mocha / src / reporters / ti-spec.js View on Github external
function log(msg) {
			console.log(cursor.resetLine + msg);
		}
github tonylukasavage / ti-mocha / src / reporters / ti-json.js View on Github external
require.register("reporters/ti-json.js", function(module, exports, require){

/**
 * Module dependencies.
 */

var Base = require('./base'),
  cursor = require('titanium/util').cursor,
  color = Base.color;

/**
 * Expose `JSON`.
 */

exports = module.exports = TiJSONReporter;

/**
 * Initialize a new `TiJSON` reporter.
 *
 * @param {Runner} runner
 * @api public
 */

function TiJSONReporter(runner) {
github tonylukasavage / ti-mocha / src / reporters / ti-spec-studio.js View on Github external
require.register("reporters/ti-spec-studio.js", function(module, exports, require){

	/**
	 * Module dependencies.
	 */

	var Base = require('./base'),
		cursor = require('titanium/util').cursor;

	/**
	 * Expose `TiSpecStudio`.
	 */

	exports = module.exports = TiSpecStudio;

	/**
	 * Initialize a new `TiSpecStudio` test reporter.
	 *
	 * @param {Runner} runner
	 * @api public
	 */

	function TiSpecStudio(runner) {
		Base.call(this, runner);
github tonylukasavage / ti-mocha / src / reporters / ti-spec.js View on Github external
require.register("reporters/ti-spec.js", function(module, exports, require){

	/**
	 * Module dependencies.
	 */

	var Base = require('./base'),
		cursor = require('titanium/util').cursor,
		color = Base.color;

	/**
	 * Expose `TiSpec`.
	 */

	exports = module.exports = TiSpec;

	/**
	 * Initialize a new `TiSpec` test reporter.
	 *
	 * @param {Runner} runner
	 * @api public
	 */

	function TiSpec(runner) {
github appcelerator-developer-relations / Forging-Titanium / ep-009 / IntentCookbook / Resources / app.js View on Github external
intent.putExtra('company', 'Appcelerator');
					return intent;
				})()
			}
		]
	},
	{
		title: 'Images, Video, & Sound',
		recipes: [
			{
				title: 'View image',
				external: true,
				intent: Ti.Android.createIntent({
					action: Ti.Android.ACTION_VIEW,
					type: 'image/jpeg',
					data: externalFiles['titanium.jpg'].nativePath
				})
			},
			{
				title: 'Capture and view image',
				external: true,
				intent: (function() {
					var intent = Ti.Android.createIntent({
						action: "android.media.action.IMAGE_CAPTURE"
					});	
					intent.putExtraUri('output', imageCaptureFile.nativePath);
					return intent;
				})(),
				callback: function(e) {
					if (imageCaptureFile.exists) {
						var intent = Ti.Android.createIntent({
							action: Ti.Android.ACTION_VIEW,

titanium

Command line interface for building Titanium SDK apps

Apache-2.0
Latest version published 3 months ago

Package Health Score

79 / 100
Full package analysis