Skip to content

Instantly share code, notes, and snippets.

@trabianmatt
Created January 4, 2013 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trabianmatt/4453777 to your computer and use it in GitHub Desktop.
Save trabianmatt/4453777 to your computer and use it in GitHub Desktop.
Example usage of titanium-backbone
# 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