Created
January 4, 2013 16:14
-
-
Save trabianmatt/4453777 to your computer and use it in GitHub Desktop.
Example usage of titanium-backbone
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
# Default Titanium API | |
button = Ti.UI.createButton | |
title: 'Testing' | |
button.addEventListener 'click', -> | |
alert 'Click!' | |
return | |
@view.add button | |
# Previous titanium-backbone API | |
button = @make 'Button', | |
title: 'Testing' | |
@delegateEventsForView button, | |
click: -> alert 'Click!' | |
@view.add button | |
# Most recent titanium-backbone API | |
$('<Button>') | |
.attr('title', 'Testing') | |
.on('click', -> alert 'Click!') | |
.appendTo @$el |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment