Why Backbone
by
Up Chen
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
Why Backbone.js
Slide 2
Slide 2 text
Up
Slide 3
Slide 3 text
www.coolpics.com.tw
Slide 4
Slide 4 text
What can Backbone solve ?
Slide 5
Slide 5 text
No content
Slide 6
Slide 6 text
No content
Slide 7
Slide 7 text
No content
Slide 8
Slide 8 text
No content
Slide 9
Slide 9 text
No content
Slide 10
Slide 10 text
No content
Slide 11
Slide 11 text
No content
Slide 12
Slide 12 text
No content
Slide 13
Slide 13 text
• Light MVC for front-end for client side • Focus on the structure • No UI widgets • Model, View, Collection, and Router.
Slide 14
Slide 14 text
Model is a thing trace = { stock: ‘台積電’, status: ‘not-added’ };
Slide 15
Slide 15 text
Bind events on Model for everything Remove Reset Change
Slide 16
Slide 16 text
Bind events on Model for everything Remove Reset Change Even bind to the variable changes change:stock
Slide 17
Slide 17 text
Original
Slide 18
Slide 18 text
Original After
Slide 19
Slide 19 text
View represents a model status: ‘not-added’ status: ‘added’ status: ‘loading’ updates itself
Slide 20
Slide 20 text
How to update itself ? Bind to model’s variables !! stock: ‘台積電’, status: ‘not-added’ change:status
Slide 21
Slide 21 text
Set and forget
Slide 22
Slide 22 text
stock: ‘宏達電’, status: ‘not-added’ traceList.set({stock:’台積電’});
Slide 23
Slide 23 text
stock: ‘台積電’, status: ‘loading’ stock: ‘宏達電’, status: ‘not-added’ ajax
Slide 24
Slide 24 text
stock: ‘宏達電’, status: ‘not-added’ stock: ‘台積電’, status: ‘loading’
Slide 25
Slide 25 text
stock: ‘台積電’, status: ‘loading’ stock: ‘台積電’, status: ‘added’ stock: ‘宏達電’, status: ‘not-added’ ajax
Slide 26
Slide 26 text
stock: ‘台積電’, status: ‘loading’ stock: ‘台積電’, status: ‘added’ stock: ‘宏達電’, status: ‘not-added’
Slide 27
Slide 27 text
stock: ‘宏達電’, status: ‘not-added’ traceList.set({stock:’台積電’});
Slide 28
Slide 28 text
Set and forget traceList.set({stock:’台積電’});
Slide 29
Slide 29 text
No content
Slide 30
Slide 30 text
Side Benefits
Slide 31
Slide 31 text
No content
Slide 32
Slide 32 text
No content
Slide 33
Slide 33 text
No content
Slide 34
Slide 34 text
No content
Slide 35
Slide 35 text
So ...
Slide 36
Slide 36 text
No content
Slide 37
Slide 37 text
Thank You
Slide 38
Slide 38 text
Recommend starting point Official Todo example http://bit.ly/trqhlV PeepCode Backbone.js basic http://bit.ly/vCcSNw
Slide 39
Slide 39 text
www.coolpics.com.tw