Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Backbone and Handlebars
Search
mulderp
March 12, 2014
Programming
3
380
Backbone and Handlebars
A small overview on the MV* pattern with Backbone.js and Handlebars
mulderp
March 12, 2014
Tweet
Share
More Decks by mulderp
See All by mulderp
Node.js for Embedded Systems
mulderp
1
2.8k
Nodebotsday
mulderp
1
130
I2C basics with Arduino
mulderp
0
210
Sharing hardware with JavaScript
mulderp
1
200
Arduino October meetup
mulderp
0
110
Physical JavaScript with Johnny-5, Cylon and Tessel
mulderp
1
1.1k
Blogging and writing about JavaScript
mulderp
2
880
Minimum Viable Interactions
mulderp
3
610
Arduino July Meetup
mulderp
0
97
Other Decks in Programming
See All in Programming
タイムゾーンの奥地は思ったよりも闇深いかもしれない
suguruooki
1
730
REALITY コマンド作成チュートリアル
nishiuriraku
0
110
KawaiiLT 登壇資料 キャリアとモチベーション
hiiragi
0
150
「”誤った使い方をすることが困難”な設計」で良いコードの基礎を固めよう / phpcon-odawara-2025
taniguhey
0
170
Jakarta EE Meets AI
ivargrimstad
0
260
Instrumentsを使用した アプリのパフォーマンス向上方法
hinakko
0
100
Make Parsers Compatible Using Automata Learning
makenowjust
2
5.6k
AHC045_解説
shun_pi
0
560
エンジニアが挑む、限界までの越境
nealle
1
280
Chrome Extension Techniques from Hell
moznion
1
160
Vibe Coding の話をしよう
schroneko
12
3k
七輪ライブラリー: Claude AI で作る Next.js アプリ
suneo3476
1
120
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
183
22k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
Embracing the Ebb and Flow
colly
85
4.7k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2k
Docker and Python
trallard
44
3.3k
Mobile First: as difficult as doing things right
swwweet
223
9.6k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
13
1.4k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
21k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
45
9.5k
Code Review Best Practice
trishagee
67
18k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
2.9k
How to train your dragon (web standard)
notwaldorf
90
6k
Transcript
Backbone and Handlebars Patrick Mulder @mulpat
library vs� frameworks�
what browsers� do� Coast by opera
pixels and� events� http://dribbble.com/shots/1043933-Listacular-UI?list=show&tag=todo_list
DOM vs� State�
DOM http://www.flickr.com/photos/sifter/245803295/ State http://www.flickr.com/photos/lcisa/4713485911/
Where change� happens�
MV*
basic� idea� http://amix.dk/blog/post/19615 user
Views State Updates Server Sync Changes UI Events DOM Templates
Backbone MV*� Keys Values
Demo time� http://www.flickr.com/photos/tronixstuff/5268597956/
http://pipefishbook.com/editor/ To be released at github, inspired by Andrei Kashcha
Better� rendering �
Backbone + handlebars
Handlebars� // simple attributes {{title}} // repitition {{#each movies}} <div>{{title}}</div>
{{/each}} // conditionals {{#if currentUser}} <div>{{ privateStuff }}</div> {{/if}} // customHelpers {{#renderStars 5}}
Demo time� http://www.flickr.com/photos/tronixstuff/5268597956/
Thorax�
Getting Started� <script src="./thorax-combined.js"></script> Results in Jquery, Underscore, Backbone, Handlebars
Hint:
CollectionView� {{#collection movies}} {{#link "details/{{_key}}" expand-tokens=true}} <li>{{title}}</li> {{/link}} {{/collection}} Also
supports filtering
Thorax.Layout� layout.setView( ... ) <div class=“container"> {{layout-element}} </div>
model lookup� someEvent: function(ev) { var target = $(ev.currentTarget); var
model = target.model(); // change model ... }
events� var listView = new Thorax.View({ el: "#movies", events: {
collection: { reset: function(ev) { // automatic bound } } } }
subviews� <div class="header"> {{view header}} </div>
itemFilter: function (model) { if (active) { return model.get('genre') ===
active; } else { return true; } } Supports filtering�
Demo time� http://www.flickr.com/photos/tronixstuff/5268597956/
Brewing� matters� http://www.flickr.com/photos/visitflanders/6328705484/
|-js! |! |---libs! |-----backbone! |-----impress! |-----masonry! |-----jquery! |-----jquery-fileupload! |-----jquery-ui! |-----require!
|-----underscore! |! |---modules! |! |! |-templates! |---dashboard! |---directory! |---shared! development production HTTP Loading JS Modules�
commonjs� � http://www.flickr.com/photos/0lhe/4450998512/
RequireJS�
Bower Yeoman
None
Demo time� http://www.flickr.com/photos/tronixstuff/5268597956/
Data Binding� http://www.flickr.com/photos/johnbostock/3356341586/
Backbone.Stickit�
Let‘s discuss mulderp@github mulpat@twitter thinkingonthinking.com