Skip to content

Instantly share code, notes, and snippets.

@buzzedword
Created July 6, 2012 21:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buzzedword/3062726 to your computer and use it in GitHub Desktop.
Save buzzedword/3062726 to your computer and use it in GitHub Desktop.
Really useful click/tap function extracted from http://docs.trigger.io/en/v1.3/best_practice/example_project.html
var click_or_tap = function(obj) {
//for property in obj, add "click " to property and use original value
var new_obj = {};
for(var property in obj) {
if (obj.hasOwnProperty(property)) {
if (forge.is.mobile()) {
new_obj["tap " + property] = obj[property];
}
else {
new_obj["click " + property] = obj[property];
}
}
}
return new_obj
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment