Skip to content

Instantly share code, notes, and snippets.

@321hendrik
Last active September 3, 2019 15:32
Show Gist options
  • Save 321hendrik/db61386b1af1abd25190e447d10b7120 to your computer and use it in GitHub Desktop.
Save 321hendrik/db61386b1af1abd25190e447d10b7120 to your computer and use it in GitHub Desktop.
console.time emulation for appcelerator titanium apps
var timers = {};
Ti.App.time = function(key) {
console.error('timer started:', key);
if (timers[key]) {
Ti.App.timeEnd(key);
}
timers[key] = new Date().getTime();
};
Ti.App.timeEnd = function(key) {
if (!timers[key]) {
return;
}
console.error(key + ':', (new Date().getTime() - timers[key]) + 'ms');
delete timers[key];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment