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
Boosting Your Productivity, with Backbone & Rac...
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Gabriel Zigolis
November 22, 2014
Technology
880
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Boosting Your Productivity, with Backbone & RactiveJS
Talk about Backbone and RactiveJS on FrontInFloripa 2014 by Gabriel Zigolis
Gabriel Zigolis
November 22, 2014
More Decks by Gabriel Zigolis
See All by Gabriel Zigolis
git flow
zigolis
0
330
Front-End Architecture for Large Scale Apps - Amsterdam
zigolis
1
210
Front-End Architecture for Large Scale Apps - Gabriel Zigolis
zigolis
7
650
SOFEA - Arquiteturas REST com Backbone & HTML5 by Gabriel Zigolis
zigolis
3
320
Bem-vindo ao Mundo Front-End por Gabriel Zigolis
zigolis
2
180
Desenvolvimento ágil com jQuery Mobile
zigolis
0
92
Workshop jQuery por Gabriel Zigolis
zigolis
0
84
Workshop / Benchmarking Performance por Gabriel Zigolis
zigolis
1
97
Workshop Padrões de Desenvolvimento Front-End por Gabriel
zigolis
1
92
Other Decks in Technology
See All in Technology
Bet AI Day 2026丨AIを「使う」から、AIが「働く」へ ― LayerXが進める「組織AI」の社会実装
layerx
PRO
2
1.4k
サーバー常駐型の 簡易障害調査AI エージェントを作ってみた話
masayoshi
1
500
AIレビュー時代に必要なのは、SLOで引く撤退ライン
nobuoooo
0
160
Claude Codeの体系的な理解と知識のフック
oikon48
10
6.4k
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.5k
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
4
25k
現場の暗黙知を継承するAIエージェント — 対話から生まれる長期記憶と Skills
atsukish
0
210
Introduction to Bill One Development Engineer
sansan33
PRO
0
490
AI駆動開発を組織で促すために
lycorptech_jp
PRO
7
9.1k
アクセスキー流出時の対応で再認識した攻撃側と防御側の非対称性について
kazzpapa3
1
510
魔法少女がClaude Codeを監視する / ccportal-deck
noriyukitakei
3
110
Sansan Engineering Unit 紹介資料
sansan33
PRO
1
5k
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
The Pragmatic Product Professional
lauravandoore
37
7.4k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.6k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
810
Measuring & Analyzing Core Web Vitals
bluesmoon
9
990
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
240
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.5k
The Cult of Friendly URLs
andyhume
79
7k
Facilitating Awesome Meetings
lara
57
7.1k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.8k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
580
Transcript
BOOSTING YOUR PRODUCTIVITY Backbone & RactiveJS Gabriel Zigolis
@zigolis Front-End Architect at Arezzo ecommerces
SCHEDULE • Getting to know Backbone • Be Ractive •
Everybody together (but separated) • Yeah, today is code day, babe!
None
backbonejs.org “Gives structure to web applications by providing models, collections
and views to consume API over a RESTful JSON interface.” BACKBONEJS
USE WHY BACKBONE ?
BECAUSE APPS THE GREW UP
NEEDING Organization Architecture Modularization MORE
CHARACTERISTICS • Powerful Javascript LIB • Adaptable, inspired on MV*
pattern • Modern, widely used in SPA • Completely skinny, bitch! Just 6.5kb.
WHO IS USING IT?
OK, LET’S SEE SOME C0D10101
Collection var ArticleCollection = Backbone.Collection.extend({ url: '/articles', model: ArticleModel });
return ArticleCollection;
Model var ArticleModel = Backbone.Model.extend({ getTitle: function() { return this.get('title');
} }); return ArticleModel;
View var AppView = Backbone.View.extend({ template: _.template( $('#tmp-article-list').html() ), el:
'.main', initialize: function () { this.collection = new Collection(); this.collection.fecth(); this.listenTo(this.collection, 'sync', this.render); }, render: function() { this.$('.list-group').html(this.template({ 'collection' : this.collection })); } }); return AppView;
_.template <div class="main"> <ul class="list-group"> <script type="text/html" id="tmp-article-list"> <% collection.each(function(model){
%> <li> <a href="#article/<%= model.id %>" class="list-group-item"> <%= model.getTitle() %> </a> </li> <% }); %> </script> </ul> </div>
COOL Now we have this
WE WANT BUT MORE
YES WE CAN! • Interactivity • Two-way binding • Animations
• SVG manipulation • {{Mustache}}
EVERYTHING KEEPING SIMPLE
ELEGANT AND PRODUCTIVE
I’m Ractive.js NICE TO MEET YOU
ractivejs.org “It's a JavaScript library for building reactive user interfaces
in a way that doesn't force you into a particular framework's way of thinking.” RACTIVEJS
USE WHY RACTIVE?
BECAUSE WE WANT • Productivity • Friendly code • Data
binding • Support to animations MORE
AND THE BESTOF
CHARACTERISTICS • A kind of magic Javascript LIB • Data-binding
(a beautiful declarative syntax) • Flexible and performant animations and transitions • {{Mustache}} template system "yay"
WHO DID IT ?
WHO'S BEEN MAINTAINING IT?
OK, LET’S TRY SOMETHING ?
TWO WAY BINDING DATA
Ractive var ractive = new Ractive({ el: '#output', template: '#tmp-name'
});
{{ template }} <label for="name"> Enter your name: </label> <input
id="name" value='{{name}}'> <p>Hello {{name}}, I am Ractive</p>
AND THE MAGIC HAPPENS
PROXIES EVENTS
Ractive var ractive = new Ractive({ el: '#output', template: '#tmp-proxy'
}); ractive.on('hello', function( event ) { alert('hello there!'); });
{{ template }} <button on-click='hello'>Hello!</button>
AND IT RETURNS THIS
WITH A LITTLE BIT MORE C0D10101 WE CAN DO AMAZING
THINGS!
LIST TODO
YES, IT’S SO NICE
COOL, NOW LET’S MIX BACKBONE RACTIVE &
RACTIVE A MVC LIB IS NOT WE NEED TO ADD
AN ADAPTOR https://github.com/ractivejs/ractive-adaptors-backbone
We must render the view ractive = new Ractive({ el:
'#output', template: '#tmp-thumbs', adaptors: [ 'Backbone' ] }); and set the adaptor
Now we can write the collection Thumbs = Backbone.Collection.extend({ model:
Thumb });
And the model Thumbs = Backbone.Model.extend({ getThumb: function() { return
this.get('thumb'); } });
Also, we can call http request xhr = new XMLHttpRequest();
xhr.open( 'get', '/thumbs' ); xhr.send();
And finally, to show on the view <ul class='thumbnails'> {{#thumbs}}
<li> <img src='/assets/img/{{thumb}}'> </li> {{/thumbs}} </ul>
WOW LOOK AT THIS
THAT'S ALL, FOLKS THANKS A LOT GITHUB SLIDESHARE SPEAKERDECK Front-End
Architect at Arezzo ecommerces @zigolis /zigolis