SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
Require.js
With a Side of Backbone.js
plus,BowerandGrunt
by: twitter: github:joefleming @w33ble w33ble
Hi, I'm Joe
Webdeveloper(8years&counting)
PHP&Node.js
LeadDev@Convrrt
WPCurrent
Contracting
Today's Agenda
BowerforFrontendLibs
Require.jswithBackbone
BuildprocesswithGrunt
ExamplesorAppfromscratch?
Caveats
Node.js
Windowsmaynotwork
Warning: Advanced Content
ASK QUESTIONS!
Let's talk evolution
Dark days of DOM
// DOM manipulation
document.getElementById('myElement');
// AJAX
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
Wrapper Libraries
Circamid-2000's
Dojo,Prototype,MooTools,jQuery,etc
// DOM manipulation
$('#myElement');
// AJAX
$.ajax(/* code here */);
There Can be Only One!
// FAIL
<script src="js/jquery.js"></script>
<script src="js/mootools.js"></script>
<script src="js/prototype.js"></script>
And Only One Version
// FAIL
<script src="js/jquery-1.6.4.js"></script>
<script src="js/jquery-1.7.2.js"></script>
<script src="js/jquery-1.8.3.js"></script>
Modules
CommonJS(formerlyServerJS)
AsynchronousModuleDefinition(AMD)
MV*
Backbone,Ember,js,Angular,Knockout,etc
Module Pattern
var someObject = { msg: 'Hello World' };
(function($, Obj, undefined) {
// Internally access jQuery as $
alert("Using jQuery verson " + $().jquery);
// Internally access someOtherObject as Obj
alert("Object says: " + Obj.msg);
})(jQuery, someObject);
AMD pattern
Asynchronouslyloads/js/classes/UserClass.js
andmakesthatmoduleavailableasUser
*AssumingabasePathof./js
// Require bootstrap
require(['classes/UserClass'], function(User) {
var Joe = new User('Joe');
alert('New user created: ' + Joe.getName());
});
User module
// User module, js/classes/UserClass.js
define(function() {
function User(name) {
this.name = name;
}
User.prototype.getName = function() {
return this.name;
}
return User;
});
JSFiddle
We'recoders
So Let's Code!
Thanks!
JoeFleming
Twitter:@w33ble
github.com/w33ble
slideshare.net/w33ble

Contenu connexe

Tendances

.NET MicroFramework by Yulian Slobodyan
.NET MicroFramework by Yulian Slobodyan.NET MicroFramework by Yulian Slobodyan
.NET MicroFramework by Yulian Slobodyan
Dima Maleev
 

Tendances (20)

Enjoy Writing Modern Desktop Application in JavaScript
Enjoy Writing Modern Desktop Application in JavaScriptEnjoy Writing Modern Desktop Application in JavaScript
Enjoy Writing Modern Desktop Application in JavaScript
 
Node.js and Ruby
Node.js and RubyNode.js and Ruby
Node.js and Ruby
 
Cryptography implementation weaknesses: based on true story
Cryptography implementation weaknesses: based on true storyCryptography implementation weaknesses: based on true story
Cryptography implementation weaknesses: based on true story
 
(C)NodeJS
(C)NodeJS(C)NodeJS
(C)NodeJS
 
Riereta Node.js session 3 (with notes)
Riereta Node.js session 3 (with notes)Riereta Node.js session 3 (with notes)
Riereta Node.js session 3 (with notes)
 
NodeJS
NodeJSNodeJS
NodeJS
 
Groovy a Scripting Language for Java
Groovy a Scripting Language for JavaGroovy a Scripting Language for Java
Groovy a Scripting Language for Java
 
Nodejs and WebSockets
Nodejs and WebSocketsNodejs and WebSockets
Nodejs and WebSockets
 
GroovyFX - Groove JavaFX
GroovyFX - Groove JavaFXGroovyFX - Groove JavaFX
GroovyFX - Groove JavaFX
 
Web of Technologies
Web of TechnologiesWeb of Technologies
Web of Technologies
 
Presentation of JSConf.eu
Presentation of JSConf.euPresentation of JSConf.eu
Presentation of JSConf.eu
 
Quick Introduction to Node.js
Quick Introduction to Node.jsQuick Introduction to Node.js
Quick Introduction to Node.js
 
Tangram
TangramTangram
Tangram
 
Devcast node.js e mongo db o casamento perfeito
Devcast   node.js e mongo db o casamento perfeitoDevcast   node.js e mongo db o casamento perfeito
Devcast node.js e mongo db o casamento perfeito
 
Introduction to using MongoDB with Ruby
Introduction to using MongoDB with RubyIntroduction to using MongoDB with Ruby
Introduction to using MongoDB with Ruby
 
20111029 qt勉強会スライド
20111029 qt勉強会スライド20111029 qt勉強会スライド
20111029 qt勉強会スライド
 
A story of Netflix and AB Testing in the User Interface using DynamoDB - DAT3...
A story of Netflix and AB Testing in the User Interface using DynamoDB - DAT3...A story of Netflix and AB Testing in the User Interface using DynamoDB - DAT3...
A story of Netflix and AB Testing in the User Interface using DynamoDB - DAT3...
 
Diving into Node with Express and Mongo
Diving into Node with Express and MongoDiving into Node with Express and Mongo
Diving into Node with Express and Mongo
 
Compressed js with NodeJS & GruntJS
Compressed js with NodeJS & GruntJSCompressed js with NodeJS & GruntJS
Compressed js with NodeJS & GruntJS
 
.NET MicroFramework by Yulian Slobodyan
.NET MicroFramework by Yulian Slobodyan.NET MicroFramework by Yulian Slobodyan
.NET MicroFramework by Yulian Slobodyan
 

Similaire à Require js + backbone, bower and grunt

State of Developer Tools (WDS09)
State of Developer Tools (WDS09)State of Developer Tools (WDS09)
State of Developer Tools (WDS09)
bgalbs
 
Why Node.js
Why Node.jsWhy Node.js
Why Node.js
guileen
 
Javascript in linux desktop (ICOS ver.)
Javascript in linux desktop (ICOS ver.)Javascript in linux desktop (ICOS ver.)
Javascript in linux desktop (ICOS ver.)
Yuren Ju
 

Similaire à Require js + backbone, bower and grunt (20)

JavaScript on the server - Node.js
JavaScript on the server - Node.jsJavaScript on the server - Node.js
JavaScript on the server - Node.js
 
Web Crawling with NodeJS
Web Crawling with NodeJSWeb Crawling with NodeJS
Web Crawling with NodeJS
 
우리가 모르는 노드로 할 수 있는 몇가지
우리가 모르는 노드로 할 수 있는 몇가지우리가 모르는 노드로 할 수 있는 몇가지
우리가 모르는 노드로 할 수 있는 몇가지
 
State of Developer Tools (WDS09)
State of Developer Tools (WDS09)State of Developer Tools (WDS09)
State of Developer Tools (WDS09)
 
[H3 2012] 우리가 모르는 Node.js로 할 수 있는 몇가지
[H3 2012] 우리가 모르는 Node.js로 할 수 있는 몇가지[H3 2012] 우리가 모르는 Node.js로 할 수 있는 몇가지
[H3 2012] 우리가 모르는 Node.js로 할 수 있는 몇가지
 
End-to-end HTML5 APIs - The Geek Gathering 2013
End-to-end HTML5 APIs - The Geek Gathering 2013End-to-end HTML5 APIs - The Geek Gathering 2013
End-to-end HTML5 APIs - The Geek Gathering 2013
 
Node js实践
Node js实践Node js实践
Node js实践
 
Nodejs a-practical-introduction-oredev
Nodejs a-practical-introduction-oredevNodejs a-practical-introduction-oredev
Nodejs a-practical-introduction-oredev
 
Node Web Development 2nd Edition: Chapter1 About Node
Node Web Development 2nd Edition: Chapter1 About NodeNode Web Development 2nd Edition: Chapter1 About Node
Node Web Development 2nd Edition: Chapter1 About Node
 
All aboard the NodeJS Express
All aboard the NodeJS ExpressAll aboard the NodeJS Express
All aboard the NodeJS Express
 
Grooscript greach
Grooscript greachGrooscript greach
Grooscript greach
 
Why Nodejs Guilin Shanghai
Why Nodejs Guilin ShanghaiWhy Nodejs Guilin Shanghai
Why Nodejs Guilin Shanghai
 
Why Node.js
Why Node.jsWhy Node.js
Why Node.js
 
Javascript in linux desktop (ICOS ver.)
Javascript in linux desktop (ICOS ver.)Javascript in linux desktop (ICOS ver.)
Javascript in linux desktop (ICOS ver.)
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS
 
How dojo works
How dojo worksHow dojo works
How dojo works
 
JavaScript Libraries (@Media)
JavaScript Libraries (@Media)JavaScript Libraries (@Media)
JavaScript Libraries (@Media)
 
Js everywhere (Georgy Bunin)
Js everywhere (Georgy Bunin)Js everywhere (Georgy Bunin)
Js everywhere (Georgy Bunin)
 
Bringing The Sexy Back To WebWorkers
Bringing The Sexy Back To WebWorkersBringing The Sexy Back To WebWorkers
Bringing The Sexy Back To WebWorkers
 
Zepto and the rise of the JavaScript Micro-Frameworks
Zepto and the rise of the JavaScript Micro-FrameworksZepto and the rise of the JavaScript Micro-Frameworks
Zepto and the rise of the JavaScript Micro-Frameworks
 

Require js + backbone, bower and grunt