SlideShare une entreprise Scribd logo
1  sur  56
Télécharger pour lire hors ligne
#dadt
Dojo Already Did That
@phiggins / JSconf.us 2013
Wednesday, May 29, 13
Me!
* JSconf alumni
* Former Dojo Project Lead
* generic code monkey
Wednesday, May 29, 13
PROFESSIONAL CAT HERDER
(TRUE OF ANY OSS LEAD)
Wednesday, May 29, 13
PRINCESS FLUFFYBUTT
(I’VE BEEN PREOCCUPIED)
Wednesday, May 29, 13
Welcome to JSCONF ...
Wednesday, May 29, 13
JSCONF
* Enjoy your lunch transition
* Digest, contemplate.
* Innovate.
Wednesday, May 29, 13
History of the World
Part III
Wednesday, May 29, 13
CELEBRATING 20 YEARS OF INTERWEBS
TUBES?
Wednesday, May 29, 13
1993-1998:
The dark ages
Wednesday, May 29, 13
`93-`98
* best when viewed in ...
* still BBSing
Wednesday, May 29, 13
1999-2000:
y2kmang
Wednesday, May 29, 13
`99-`NaN
* Ajax
* IE 5(ish)
* Netscape 5(ish)
* Opera 4(ish)
* lynx
* Konqueror
Wednesday, May 29, 13
2001-2005:
A renaissance of sorts.
Wednesday, May 29, 13
`01-`05
* Flash.
* Everywhere.
* Lots of learning, hacking.
* Beginnings of js libs
Wednesday, May 29, 13
2006-2009:
Sweet spot.
Wednesday, May 29, 13
`06-`09
* Lots of fighting.
* ... we’ll double back.
* Dojo doing things
Wednesday, May 29, 13
2010-Date.now()
The modern era.
Wednesday, May 29, 13
`11+
HTTPS://SPEAKERDECK.COM/ANGUSCROLL/THE-POLITICS-OF-JAVASCRIPT
Wednesday, May 29, 13
`11+
HTTPS://SPEAKERDECK.COM/ANGUSCROLL/THE-POLITICS-OF-JAVASCRIPT
Wednesday, May 29, 13
And Dojo Did?
It.
Wednesday, May 29, 13
<div dojoType="foo.bar.baz"></div>
Wednesday, May 29, 13
<div dojoType="foo.bar.baz"></div>
var cls = getObject(node.getAttribute("dojoType"));
new cls({ props }, node);
Wednesday, May 29, 13
<!-- div dojoType="foo.bar.baz"></div-->
<div data-dojo-type="foo.bar.baz"></div>
var cls = getObject(node.getAttribute("data-dojo-type"));
new cls({ props }, node);
Wednesday, May 29, 13
<!-- div dojoType="foo.bar.baz"></div-->
<div data-dojo-type="foo.bar.baz"></div>
var cls = getObject(node.getAttribute("data-dojo-type"));
new cls({ props }, node);
// WAT? no dataset?
Wednesday, May 29, 13
var hasDataset = (function(){
var n = document.createElement("div");
n.setAttribute("data-a-b", "c");
return !!(n.dataset && n.dataset.aB == "c");
})();
Wednesday, May 29, 13
var getdata, setdata;
if(hasDataset){
getdata = function(n, prop){ return n.dataset[prop]; };
setdata = function(n, prop, data){ n.dataset[prop] = data; };
}else{
function _hypen(m){ return "-" + m.toLowerCase(); }
function toDataHyphen(str){ return "data-" + str.replace(/[A-Z]/g, _hypen); }
getdata = function(n, prop){
return n.getAttribute(toDataHyphen(prop));
};
setdata = function(n, prop, data){
n.setAttribute(toDataHyphen(prop), data);
};
}
var cls = getObject(getdata(node, "dojoType"));
new cls({ props }, node);
Wednesday, May 29, 13
<div dojoType="foo.bar.baz"></div>
<div data-dojo-type="foo.bar.baz"></div>
// Backboneish
new MyView({
$el: $(node)
})
// bootstrappy
<button data-reset-text="ha" data-foo-text="bar!"
>ha</button>
$("button").button("foo");
Wednesday, May 29, 13
Module Loading
o/
Wednesday, May 29, 13
Wednesday, May 29, 13
// fetch foo/bar/__package__.js
dojo.require("foo.bar.*");
dojo.addOnLoad(function(){
console.warn(foo.bar.baz)
});
Wednesday, May 29, 13
// fetch foo/bar/baz.js
dojo.require("foo.bar.baz");
dojo.addOnLoad(function(){
console.warn(foo.bar.baz)
});
Wednesday, May 29, 13
// fetch foo/bar/baz.js
dojo.require("foo.bar.baz");
SYNCHRONOUS XHR + EVAL
dojo.provide("foo.bar.baz");
dojo.require("foo.bar.baz.bam");
foo.bar.baz = { bam: true };
REPEAT.
Wednesday, May 29, 13
SYNCHRONOUS XHR + EVAL
* ORIGIN LIMITATIONS
* **
** EVIL (?)
Wednesday, May 29, 13
James burke
Dojo / AMD / requirejs / et al
Wednesday, May 29, 13
dojo._xdResourceLoaded(function(){
return {
depends:[
["provide","dojo.foo"],
],
defineResource: function(dojo, dijit, dojox){
if(!dojo._hasResource["dojo.foo"]){
dojo._hasResource["dojo.foo"] = true;
/* original code */
}
}
};
});
Wednesday, May 29, 13
AMD
* asynchronous
* anonymous
* x-domain
Wednesday, May 29, 13
define(["foo/bar/baz"], function(foobarbaz){
return {
bam: true
};
});
Wednesday, May 29, 13
node.js /
ecma
* Still being argued
* UMD a mess
Wednesday, May 29, 13
BACKEND JAVASCRIPT
NODE, ET AL
Wednesday, May 29, 13
Dojo Did
* Rhino / multi-env support
* Dojo Build tools
* dojox.dtl
Wednesday, May 29, 13
Dojo Did
* Rhino / multi-env support
* Dojo Build tools
* dojox.dtl
ADDED NODE.JS
USING NODE.JS
ABANDONED :(
Wednesday, May 29, 13
No end to Node potential.
Wednesday, May 29, 13
UI LIBRARIES
AND “PLUGINS”
Wednesday, May 29, 13
Dijit
... could do a whole talk here
Wednesday, May 29, 13
Dijit
* instance based control
* externalized resources
* a11y
* l10n / i18n
Wednesday, May 29, 13
Dijit
* Backwards compatible
* Unified “everything”
Wednesday, May 29, 13
Dijit could:
* better event registration
* alternate templating
Wednesday, May 29, 13
CORE JS
... IT’S JUST JAVASCRIPT
Wednesday, May 29, 13
Underscore
* lots of handy stuff.
Wednesday, May 29, 13
Underscore
“The tie to go with jQuery’s tux”
Wednesday, May 29, 13
Underscore
Shouldn’t have to fix
* map()
* or bind()
* or `this`
Wednesday, May 29, 13
Underscore
is not amd/umd ready ...*
* LODASH
Wednesday, May 29, 13
Lots of stuff
is not amd/umd ready ...
Wednesday, May 29, 13
It’s Just JS
* Don’t be limited by “best
practice”
* Understand the language
* Enjoy the nuance
Wednesday, May 29, 13
Questions?
Wednesday, May 29, 13
PROJECT
DATE CLIENT
29/5/2013 @PHIGGINS
FIN.
GRACIAS.
Wednesday, May 29, 13

Contenu connexe

Tendances

F*cking with fizz buzz
F*cking with fizz buzzF*cking with fizz buzz
F*cking with fizz buzz
Scott Windsor
 
Beautiful PHP CLI Scripts
Beautiful PHP CLI ScriptsBeautiful PHP CLI Scripts
Beautiful PHP CLI Scripts
Jesse Donat
 
10 reasons to love CoffeeScript
10 reasons to love CoffeeScript10 reasons to love CoffeeScript
10 reasons to love CoffeeScript
Lukas Alexandre
 
Seattle.rb 6.4
Seattle.rb 6.4Seattle.rb 6.4
Seattle.rb 6.4
deanhudson
 

Tendances (20)

Gitkata refspec
Gitkata refspecGitkata refspec
Gitkata refspec
 
Linux Command Line
Linux Command LineLinux Command Line
Linux Command Line
 
Dicas de SSH
Dicas de SSHDicas de SSH
Dicas de SSH
 
Comets notes
Comets notesComets notes
Comets notes
 
Trio of Gems
Trio of GemsTrio of Gems
Trio of Gems
 
F*cking with fizz buzz
F*cking with fizz buzzF*cking with fizz buzz
F*cking with fizz buzz
 
A toolbelt of seasoned bug hunter - Damir Zekic
A toolbelt of seasoned bug hunter - Damir ZekicA toolbelt of seasoned bug hunter - Damir Zekic
A toolbelt of seasoned bug hunter - Damir Zekic
 
File::CleanupTask
File::CleanupTaskFile::CleanupTask
File::CleanupTask
 
Zsh shell-for-humans
Zsh shell-for-humansZsh shell-for-humans
Zsh shell-for-humans
 
Neoito — *NIX kungfu for web devs
Neoito — *NIX kungfu for web devsNeoito — *NIX kungfu for web devs
Neoito — *NIX kungfu for web devs
 
Ssh2 install
Ssh2 installSsh2 install
Ssh2 install
 
儲かるドキュメント
儲かるドキュメント儲かるドキュメント
儲かるドキュメント
 
OSMC2010 Open NMS Kickstart
OSMC2010 Open NMS KickstartOSMC2010 Open NMS Kickstart
OSMC2010 Open NMS Kickstart
 
Git installation
Git installationGit installation
Git installation
 
Beautiful PHP CLI Scripts
Beautiful PHP CLI ScriptsBeautiful PHP CLI Scripts
Beautiful PHP CLI Scripts
 
Hubot
HubotHubot
Hubot
 
1
11
1
 
Roll your own web crawler. RubyDay 2013
Roll your own web crawler. RubyDay 2013Roll your own web crawler. RubyDay 2013
Roll your own web crawler. RubyDay 2013
 
10 reasons to love CoffeeScript
10 reasons to love CoffeeScript10 reasons to love CoffeeScript
10 reasons to love CoffeeScript
 
Seattle.rb 6.4
Seattle.rb 6.4Seattle.rb 6.4
Seattle.rb 6.4
 

Plus de Peter Higgins (8)

has("builds")
has("builds")has("builds")
has("builds")
 
has.js
has.jshas.js
has.js
 
Just JavaScript
Just JavaScriptJust JavaScript
Just JavaScript
 
Txjs
TxjsTxjs
Txjs
 
dojo.things()
dojo.things()dojo.things()
dojo.things()
 
dojo.Patterns
dojo.Patternsdojo.Patterns
dojo.Patterns
 
Trimming The Cruft
Trimming The CruftTrimming The Cruft
Trimming The Cruft
 
Zero To Dojo
Zero To DojoZero To Dojo
Zero To Dojo
 

Jsconf.us.2013