Last active
December 11, 2015 03:39
-
-
Save trabianmatt/4539640 to your computer and use it in GitHub Desktop.
A preview of what's in store for titanium-backbone. (Ignore the numbers and underscores in the file names - they are intended only to provide order to the gists).
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
SampleWindow = require './window' | |
person = new Backbone.Model | |
name: 'John Doe' | |
sampleWindow = new SampleWindow | |
model: person | |
sampleWindow.render().open() | |
# Update the person's name after 3 seconds. This update will be reflected in the view | |
setTimeout -> | |
person.set | |
name: 'Jane Doe' | |
, 3000 |
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
styles = require './styles' | |
template = require './template' | |
class SampleWindow extends Backbone.View | |
tagName: 'Window' | |
styles: styles | |
bindings: | |
'.name': 'name' | |
events: | |
'click .cancel': 'cancel' | |
'click .save': 'save' | |
cancel: -> | |
@el.close() | |
save: -> | |
@model.save().done => | |
@el.close() | |
render: -> | |
@$el.html template | |
headingText: 'This is a sample' | |
@ | |
open: -> @el.open() |
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
Label.heading= headingText | |
Label.name | |
.buttons.horizontal | |
Button.save Save | |
Button.cancel Cancel |
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
Window | |
backgroundColor #ccc | |
.horizontal | |
layout: horizontal | |
.buttons | |
top: 11 | |
Label | |
color #333 | |
.heading | |
font 14px bold | |
.name | |
font 12px |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment