Created
February 14, 2011 03:19
-
-
Save collegeman/825437 to your computer and use it in GitHub Desktop.
I found this log() function very useful for exploring the Titanium API. The WebKit console is simply the best way to explore JavaScript objects. This implementation of a global log() function makes it easy to use the WebKit logger to inspect any object, i
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
(function(T, api) { | |
function log() { | |
if (window.console) { | |
window.console.log.apply(null, Array.prototype.slice.call(arguments)); | |
} else { | |
api.prototype.log.apply(null, Array.prototype.slice.call(arguments)); | |
} | |
} | |
T.UI.getMainWindow().showInspector(true); | |
// listen for open requests (drag and drop on the desktop icon) | |
T.addEventListener(T.ALL, function(evt) { | |
if (evt.getType() == 'open.request' && evt.files.length) { | |
T.Platform.openApplication(evt.files[0]); | |
} | |
log(evt.getType(), evt, evt.getTarget()); | |
}); | |
})(Titanium, Titanium.API); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment