Skip to content

Instantly share code, notes, and snippets.

@airportyh
Last active December 15, 2015 01:19
Show Gist options
  • Select an option

  • Save airportyh/5178916 to your computer and use it in GitHub Desktop.

Select an option

Save airportyh/5178916 to your computer and use it in GitHub Desktop.
function ITEM_VIEW(){ with(BindUp) { return (
SECTION({id: 'item-view'},
H2($('name'),
IMG({
src: $('imageURL'),
alt: 'Side-view shot'
}),
LABEL('Price'), SPAN($('price')),
SECTION(
{
id: 'reviews',
style: {
display: $ifelse(
'reviews.length',
'block', 'none')
}
},
UL(
$each('reviews',
LI(
H3($('title')),
P($('text'))
)
)
)
)
)
)}}
var item = {
name: 'Big Huge Muffin',
imageURL: 'http://s3.amazon.com/.../big_hugh_muffin.jpg',
price: 12.99,
reviews: [
...
]
}
var view = ITEM_VIEW().bind(item)
view.renderTo(document.body)
item.price = 14.99
view.update()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment