Created
July 6, 2012 21:00
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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