SlideShare a Scribd company logo
dojo.things()


                   Peter Higgins (dante)
                  Dojo Toolkit Project Lead
                 ZendCon 2009 (#zendcon)
                      October 19 - 23


Thursday, October 22, 2009
me.
                             http://twitter.com/phiggins
                             http://dante.dojotoolkit.org

                                 http://joind.in/936




Thursday, October 22, 2009
Thursday, October 22, 2009
The History of Dojo
                                  (über-cliffnote version)




Thursday, October 22, 2009
A Foundation.




Thursday, October 22, 2009
A Team.




             http://demos.dojotoolkit.org/demos/skew/




Thursday, October 22, 2009
The Dojo Toolkit



         • Long standing Development
         • Friendly Professional Community
         • Liberally Licensed, Clean IP




        http://dojotoolkit.org http://dojofoundation.org

Thursday, October 22, 2009
What is Dojo?

            • Unified JavaScript Toolkit
              - Supafast Light-weight Base (6k - 30k)
                - Package System
                - Use at will Library
                  - Countless tools
              - Exposed Foundations
              - Defined deprecation policies
              - Defined release policies
Thursday, October 22, 2009
http://xkcd.com/353

Thursday, October 22, 2009
It’s just JavaScript.




Thursday, October 22, 2009
Base Dojo (aka: dojo.js)




Thursday, October 22, 2009
<?php echo $this->dojo() ?>




Thursday, October 22, 2009
What you get:
            •   DOM:
                  -   byId, attr, place, clone, create, empty, position
            •   CSS:
                  -   style, addClass, removeClass, toggleClass, hasClass
            •   Ajax:
                  -   xhr, xhrGet/Post/Delete/Put, Deferred
            •   Language:
                  -   connect, hitch, partial, delegate, declare, mixin, extend
            •   Array:
                  -   forEach, map, filter, indexOf, lastIndexOf, some, every
            •   JSON:
                  -   toJson, fromJson, queryToObject, objectToQuery, formToJson/Object/Query
            •   FX:
                  -   Color Animations, anim, animateProperty, fadeIn/Out

        -   http://download.dojotoolkit.org/current-stable/cheat.html

Thursday, October 22, 2009
dojo.query / dojo.NodeList

            • Fastest available Selector Engine - “Acme”
            • 1:1 pairing with dojo.* functions
               - dojo.style(“nodeid”, { props }) // fast
               - dojo.query(“#nodeid”).style({ props }) // sugar
            • Syntatic Sugar for events:
               - dojo.query(“.bar”).onclick(fnA).onmouseenter(fnB)




Thursday, October 22, 2009
Dojo Plugins

               // give all NodeList instances a hash of new functions:
               dojo.extend(dojo.NodeList, {
                  color: function(color){
                     // set nodes to a color. getter/setter:
                     return this.style(“color”, color);
                  },
                  html: function(markup){
                     // set the HTML to some passed markup snippet
                     return this.forEach(function(n){
                        n.innerHTML = markup;
                     });
                  }
               });




Thursday, October 22, 2009
Bling.

               (function($){

                     $(“#foo .bar”)
                        .onclick(function(e){
                           // normalized ‘e’
                        })
                        .forEach(function(n){
                           // closed ‘n’
                           dojo.attr(n, “title”, “Touched”)
                        })
                        .attr(“title”, “ReTouched!”)
                     ;

               })(dojo.query);




Thursday, October 22, 2009
Package Basics

            • API:
              - provide(module)
              - require(module)
              - platformRequire(platform, module)
              - requireIf(someCondition, module)
              - registerModulePath(namespace, path)




Thursday, October 22, 2009
With Zend Framework ...
               // teh php:
               $this->dojo()->enable()
                  ->registerModulePath(“myns”, “../myns”)
                  ->requireModule(“myns.plugin”);

               // and js: ../myns/plugin.js
               dojo.provide(“myns.plugin”);
               (function($, d){

                     d.extend(d.NodeList, { ... });

                     d.declare(“myns.Thing”, null, {
                         template: d.cache(“myns”, “templates/Thing.html”),
                         constructor: function(args, node){
                            d.mixin(this, args);
                            d.place(this.template, node, “replace”);
                         }
                     });

               })(dojo.query, dojo);




Thursday, October 22, 2009
Using “layers”

               // teh php:
               $this->dojo()->enable()
                  ->registerModulePath(“myns”, “../myns”)
                  ->requireModule(“myns.kernel”);
               // or:
               $view->dojo()->addLayer(“/js/myns/kernel.js”);

               // and js: ../myns/kernel.js
               dojo.provide(“myns.kernel”);
               dojo.require(“myns.stuff”);
               dojo.require(“dojox.image.LightboxNano”);
               dojo.require(“myns.FirstWidget”);




Thursday, October 22, 2009
Ajax is eaaaaasy

            • All route through dojo.xhr(verb, kwArgs)
            • Common dojo.Deferred interface
            • Definable custom content handlers




Thursday, October 22, 2009
Ajax is eaaaaasy
               // basic.
               dojo.xhrGet({
                   url:”/foo”,
                   load: function(data){
                      dojo.byId(“bar”).innerHTML = data;
                   }
               });

               // direct dfd
               var inflight = dojo.xhrGet({ url:”/foo” })
                  .addCallback(function(data){ ... })
                  .addErrback(function(error){ ... })
               ;

               // alternate content-type:
               dojo.xhrPost({
                   url:”/foo/bar”,
                   handleAs:”json”,
                   load: function(data){
                      for(var i in data){ ... }
                   }
               });




Thursday, October 22, 2009
Custom Content Handlers

               // define the content-handler
               dojo.mixin(dojo.contentHandlers, {
                   loadInto: function(xhr){
                      var n = dojo.byId(xhr.ioArgs.node);
                      n.innerHTML = xhr.responseText;
                   }
               });

               // use the content-handler
               dojo.xhrGet({
                   url:”/foo”,
                   handleAs:”loadInto”,
                   node:”someId”
               });




Thursday, October 22, 2009
Events

            • dojo.connect
               - DOM or Functional
               - Built-in scoping (everywhere!)
               - Explicit disconnect
            • Topics
               - publish/subscribe/unsubscribe




Thursday, October 22, 2009
Events

               var n = dojo.byId(“foo”);

               // plain ole’ onclick
               dojo.connect(n, “click”, function(e){ ... });

               // calls thisObj.method(e) in scope of thisObj
               dojo.connect(n, “mouseenter”, thisObj, “method”);

               // anonymous with scope
               dojo.connect(n, “keydown”, thisObj, function(e){
                   // “this” == thisObj
               });

               // with query:
               dojo.query(“#foo”)
                  .onclick(function(e){ })
                  .onmouseenter(thisObj, “method”)
                  .onkeydown(thisObj, function(e){ ... })
               ;




Thursday, October 22, 2009
Topics



               // same hitching pattern:
               dojo.subscribe(“/are/you/listening”, function(a, b, c){ ... });
               dojo.subscribe(“/are/you/listening”, thisObj, “method”);
               dojo.subscribe(“/are/you/listening”, thisObj, function(){ ... });

               // trigger it all
               dojo.publish(“/are/you/listening”, [1, 2, 3]);




Thursday, October 22, 2009
hitch()

               // mini singleton
               var myObj = {
                  counter:0,
                  addOne: function(){
                     this.counter++;
                  }
               }

               // more hitching pattern:
               dojo.connect(n, “onclick”, myObj, “addOne”);
               dojo.subscribe(“/who/knows”, myObj, “addOne”);

               var adder = dojo.hitch(myObj, “addOne”);
               dojo.connect(n, “mouseenter”, adder);




Thursday, October 22, 2009
hitch() for Classes

               dojo.declare(“my.Thing”, null, {
                   url:”/foo”,
                   message:””,
                   loader: function(){
                      dojo.xhrGet({
                         url: this.url,
                         load: dojo.hitch(this, “handler”)
                      })
                   },
                   handler: function(data){
                      this.message = data;
                   }
               });

               var mt = new my.Thing();
               mt.loader();




Thursday, October 22, 2009
FX

            • dojo.animateProperty(kwArgs)
            • dojo.anim(node, props, ...)
            • dojo.fadeOut(kwArgs)
            • dojo.fadeIn(kwArgs)
            • new dojo.Animation(kwArgs)




Thursday, October 22, 2009
Animation Events

               var anim = dojo.fadeOut({ node:”bar” });
               dojo.connect(anim, “onEnd”, function(n){
                   // animation is done
               });
               dojo.connect(anim, “beforeBegin”, function(n){
                   // animation starts after this
               });
               dojo.connect(anim, “onBegin”, function(n){
                   // animation just started
               });
               anim.play();

               // also onAnimate, onPlay, onStop, etc.

               dojo.fadeOut({ node:”baz”, onEnd:function(n){ /* inline, too */ }).play();




Thursday, October 22, 2009
FX++

            • dojo.require(“dojo.fx”); // or dojox.fx ...
            • dojo.fx.chain([animations])
            • dojo.fx.combine([animations]);
            • dojo.fx.wipeIn/Out/slideIn/Out/etc




Thursday, October 22, 2009
Core Dojo




Thursday, October 22, 2009
dojo.require() away

            • dojo.data
              - Common API for data handling
            • Advanced I/O
              - dojo.io.script, dojo.io.iframe ...
            • dojo.cookie
            • dojo.behavior!




Thursday, October 22, 2009
Behavior?

               dojo.behavior.add({
                   “.foo .bar”: function(n){
                      // newly found
                   },
                   “#baz”:{
                      “found”: function(n){
                         // also newly found
                      },
                      “onclick”: function(e){
                         // handler
                      }
                   }
               });

               dojo.behavior.apply();




        Live behaviors available in `plugd`

Thursday, October 22, 2009
Firebug Lite


Thursday, October 22, 2009
Dijit (Dojo Widgets)




Thursday, October 22, 2009
Dijit widget system

            • dijit._Widget / dijit._Templated / etc
            • dijit.Dialog / dijit.layout.TabContainer / etc
            • dijit.form.ValidationTextBox / etc




Thursday, October 22, 2009
Declarative vs Programatic


               new dijit.Dialog({
                   title:”Hi There”,
                   href:”/foo/bar”,
                   id:”bar”
               });

               <!-- same as: -->
               <div id=”bar” dojoType=”dijit.Dialog” title=”Hi There” href=”/foo/bar”></div>




Thursday, October 22, 2009
Declarative vs Programatic



               Zend_Dojo_View_Helper_Dojo::setUseDeclarative();

               Zend_Dojo_View_Helper_Dojo::setUseProgrammatic();

               Zend_Dojo_View_Helper_Dojo::setUseProgrammatic(-1);




Thursday, October 22, 2009
customDijit FTW!
               // consider:
               new my.Thing({ someAttribute:”something” }, “nodeid”)

               // versus:
               <div dojoType=”my.Thing” someAttribute=”something” id=”nodeid”>
                  <p>Inner Content</p>
               </div>

               // in PHP:
               <?php $this->customDijit()->captureStart(
                  ‘baaar’,
                  array(
                     dojoType => “my.Thing”,
                     someAttribute => “something”
                  )
               ); ?>
                  <p>Inner Content</p>
               <? php echo $this->customDijit()->captureEnd(‘baaar’); ?>




Thursday, October 22, 2009
DojoX
                             (X !== experimental)




Thursday, October 22, 2009
DojoX, briefly.

            • Sandbox
            • Cutting Edge
            • Un-categorized




Thursday, October 22, 2009
DojoX, briefly.

            • dojox.gfx
            • dojox.charting
            • dojox.cometd / org.cometd
            • dojox.grid
            • dojox.widget / dojox.layout / dojox.form
            • dojox.image
            • dojox.data
            • dojox.rpc / SMD


Thursday, October 22, 2009
RPC / SMD


               dojo.require(“dojox.rpc.Service”);

               var goog = new dojox.rpc.Service(“google.smd”);

               goog.websearch({ q:”Dojo” }).addCallback(function(response){
                  // handle the responses
               });

               goog.booksearch({ q:”Dojo” }).addBoth(function(response){
                  // Books about Dojo
               });




Thursday, October 22, 2009
dojox.data Stores:
            • AndOrReadStore     • FlickrRestStore /
            • AppStore             FlickrStore
            • AtomReadStore      • GoogleFeedStore
            • CouchDBRestStore   • GoogleSearchStore
            • CssRuleStore       • HtmlStore
            • CsvStore           • jsonPathStore
            • FileStore          • jsonRestStore
                                 • OpmlStore

Thursday, October 22, 2009
Dojo Build System




Thursday, October 22, 2009
All-in-One

            • Works transparently with Package System
            • Group modules into ‘layers’
            • Concatenate CSS @import into ‘layers’
            • Layer & File minification
               - Comments, Whitespace, newlines ...
            • stripConsole (console.warn, .log, .error)


Thursday, October 22, 2009
#ifdef in JavaScript?

        // the code:
        //>>excludeStart(“something”, kwArgs.condition == true);
        /* code to exclude */
        //>>excludeStop(“something”);


        # exclude it:
        ./build.sh condition=true profile=myprofile




Thursday, October 22, 2009
Development Debugging

               // ...
               handler: function(data){
                  if(data && !data.error){
                     /* do something with the data */
                  }
                  //>>excludeStart(“debuggykins”, true);
                  else{
                     console.warn(“We require data, and didn’t get it.”);
                     console.log(“got:”, arguments);
                  }
                  //>>excludeStop(“debuggykins”);
               },
               // ...




Thursday, October 22, 2009
Special Builds

            • Stubs (6k dojo.js)
            • Base++ (dojo.js with modules)
            • Cross-Domain
            • plugd
            • Scope Burning



Thursday, October 22, 2009
MooJo?




Thursday, October 22, 2009
scopeMap + kwArgs


               // Dojo?
               Moo.load(function(){
               
    place("<p>Hello, Moojo</p>", "container");
               
    query("p")
               
    
 .style("fontSize", "10px")
               
    
 .animate({
               
    
 
 fontSize:{ end: 42 }
               
    
 })
                    ;
               });




        http://dante.dojotoolkit.org/static/otherlibs/moojo.html

Thursday, October 22, 2009
//>>excludeStart(“auto”, kwArgs.autoConflict == “on”)
               if(dojo.config.conflict){
               //>>excludeStop(“auto”)

                     // exportNS is a plugd plugin
                     dojo.exportNS(dojo, dojo.global);

               //>>excludeStart(“auto”, kwArgs.autoConflict == “on”)
               }
               //>>excludeStop(“auto”)




        http://dante.dojotoolkit.org/static/otherlibs/moojo.html

Thursday, October 22, 2009
Questions?




Thursday, October 22, 2009
Gracias.

                                 (me, again)
                                 dante@dojotoolkit.org
                              http://twitter.com/phiggins
                             http://higginsforpresident.net/
                              http://dante.dojotoolkit.org

                                   http://joind.in/936




Thursday, October 22, 2009
Some resources:
                                     http://dojotoolkit.org
                               http://dojocampus.org/explorer
                                    http://dojocampus.org
                               http://download.dojotoolkit.org
                                 http://docs.dojocampus.org
                                http://demos.dojotoolkit.org




Thursday, October 22, 2009

More Related Content

What's hot

Javascript essential-pattern
Javascript essential-patternJavascript essential-pattern
Javascript essential-pattern
偉格 高
 
Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs偉格 高
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almost
Quinton Sheppard
 
this
thisthis
Swift와 Objective-C를 함께 쓰는 방법
Swift와 Objective-C를 함께 쓰는 방법Swift와 Objective-C를 함께 쓰는 방법
Swift와 Objective-C를 함께 쓰는 방법
Jung Kim
 
Using Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer ArchitectureUsing Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer Architecture
Garann Means
 
The jQuery Divide
The jQuery DivideThe jQuery Divide
The jQuery Divide
Rebecca Murphey
 
Objective-C A Beginner's Dive (with notes)
Objective-C A Beginner's Dive (with notes)Objective-C A Beginner's Dive (with notes)
Objective-C A Beginner's Dive (with notes)
Altece
 
JavaScript - From Birth To Closure
JavaScript - From Birth To ClosureJavaScript - From Birth To Closure
JavaScript - From Birth To Closure
Robert Nyman
 
Sprockets
SprocketsSprockets
Everything is Permitted: Extending Built-ins
Everything is Permitted: Extending Built-insEverything is Permitted: Extending Built-ins
Everything is Permitted: Extending Built-ins
Andrew Dupont
 
JavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talkJavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talk
Thomas Kjeldahl Nilsson
 
Your JavaScript Library
Your JavaScript LibraryYour JavaScript Library
Your JavaScript Library
Dmitry Baranovskiy
 
Active Support Core Extensions (1)
Active Support Core Extensions (1)Active Support Core Extensions (1)
Active Support Core Extensions (1)
RORLAB
 
JavaScript Patterns
JavaScript PatternsJavaScript Patterns
JavaScript Patterns
Stoyan Stefanov
 
Chrome拡張開発者のためのFirefox拡張開発
Chrome拡張開発者のためのFirefox拡張開発Chrome拡張開発者のためのFirefox拡張開発
Chrome拡張開発者のためのFirefox拡張開発
swdyh
 
Prototypal inheritance in JavaScript
Prototypal inheritance in JavaScriptPrototypal inheritance in JavaScript
Prototypal inheritance in JavaScript
Miroslav Obradović
 
Clojure basics
Clojure basicsClojure basics
Clojure basicsKyle Oba
 
jQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & CompressionjQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & CompressionPaul Irish
 

What's hot (20)

Javascript essential-pattern
Javascript essential-patternJavascript essential-pattern
Javascript essential-pattern
 
Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almost
 
this
thisthis
this
 
Swift와 Objective-C를 함께 쓰는 방법
Swift와 Objective-C를 함께 쓰는 방법Swift와 Objective-C를 함께 쓰는 방법
Swift와 Objective-C를 함께 쓰는 방법
 
Using Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer ArchitectureUsing Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer Architecture
 
The jQuery Divide
The jQuery DivideThe jQuery Divide
The jQuery Divide
 
Objective-C A Beginner's Dive (with notes)
Objective-C A Beginner's Dive (with notes)Objective-C A Beginner's Dive (with notes)
Objective-C A Beginner's Dive (with notes)
 
JavaScript - From Birth To Closure
JavaScript - From Birth To ClosureJavaScript - From Birth To Closure
JavaScript - From Birth To Closure
 
Sprockets
SprocketsSprockets
Sprockets
 
Prototype
PrototypePrototype
Prototype
 
Everything is Permitted: Extending Built-ins
Everything is Permitted: Extending Built-insEverything is Permitted: Extending Built-ins
Everything is Permitted: Extending Built-ins
 
JavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talkJavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talk
 
Your JavaScript Library
Your JavaScript LibraryYour JavaScript Library
Your JavaScript Library
 
Active Support Core Extensions (1)
Active Support Core Extensions (1)Active Support Core Extensions (1)
Active Support Core Extensions (1)
 
JavaScript Patterns
JavaScript PatternsJavaScript Patterns
JavaScript Patterns
 
Chrome拡張開発者のためのFirefox拡張開発
Chrome拡張開発者のためのFirefox拡張開発Chrome拡張開発者のためのFirefox拡張開発
Chrome拡張開発者のためのFirefox拡張開発
 
Prototypal inheritance in JavaScript
Prototypal inheritance in JavaScriptPrototypal inheritance in JavaScript
Prototypal inheritance in JavaScript
 
Clojure basics
Clojure basicsClojure basics
Clojure basics
 
jQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & CompressionjQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & Compression
 

Similar to dojo.things()

dojo.Patterns
dojo.Patternsdojo.Patterns
dojo.Patterns
Peter Higgins
 
Trimming The Cruft
Trimming The CruftTrimming The Cruft
Trimming The Cruft
Peter Higgins
 
Getting Started with Dojo Toolkit
Getting Started with Dojo ToolkitGetting Started with Dojo Toolkit
Getting Started with Dojo Toolkit
Thomas Koch
 
Dojo Basics Js UserGroup Chicago
Dojo Basics Js UserGroup ChicagoDojo Basics Js UserGroup Chicago
Dojo Basics Js UserGroup Chicago
wolframkriesing
 
Organizing Code with JavascriptMVC
Organizing Code with JavascriptMVCOrganizing Code with JavascriptMVC
Organizing Code with JavascriptMVC
Thomas Reynolds
 
Txjs
TxjsTxjs
Dojo >= 1.7 Kickstart
Dojo >= 1.7  KickstartDojo >= 1.7  Kickstart
Dojo >= 1.7 Kickstart
Hazem Saleh
 
Tornadoweb
TornadowebTornadoweb
Tornadoweb
Osman Yuksel
 
Dojo Confessions
Dojo ConfessionsDojo Confessions
Dojo Confessions
Rebecca Murphey
 
Week 4 - jQuery + Ajax
Week 4 - jQuery + AjaxWeek 4 - jQuery + Ajax
Week 4 - jQuery + Ajaxbaygross
 
Web Crawling with NodeJS
Web Crawling with NodeJSWeb Crawling with NodeJS
Web Crawling with NodeJS
Sylvain Zimmer
 
kissy-past-now-future
kissy-past-now-futurekissy-past-now-future
kissy-past-now-futureyiming he
 
KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天
tblanlan
 
Building Dojo in the Cloud
Building Dojo in the CloudBuilding Dojo in the Cloud
Building Dojo in the Cloud
James Thomas
 
Inside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source DatabaseInside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source Database
Mike Dirolf
 
How DRY impacts JavaScript performance // Faster JavaScript execution for the...
How DRY impacts JavaScript performance // Faster JavaScript execution for the...How DRY impacts JavaScript performance // Faster JavaScript execution for the...
How DRY impacts JavaScript performance // Faster JavaScript execution for the...
Mathias Bynens
 
Intro to HTML5 Web Storage
Intro to HTML5 Web StorageIntro to HTML5 Web Storage
Intro to HTML5 Web Storagedylanks
 
How dojo works
How dojo worksHow dojo works
How dojo works
Amit Tyagi
 
jQuery Learning
jQuery LearningjQuery Learning
jQuery LearningUzair Ali
 
The Dojo Toolkit An Introduction
The Dojo Toolkit   An IntroductionThe Dojo Toolkit   An Introduction
The Dojo Toolkit An Introduction
Jeff Fox
 

Similar to dojo.things() (20)

dojo.Patterns
dojo.Patternsdojo.Patterns
dojo.Patterns
 
Trimming The Cruft
Trimming The CruftTrimming The Cruft
Trimming The Cruft
 
Getting Started with Dojo Toolkit
Getting Started with Dojo ToolkitGetting Started with Dojo Toolkit
Getting Started with Dojo Toolkit
 
Dojo Basics Js UserGroup Chicago
Dojo Basics Js UserGroup ChicagoDojo Basics Js UserGroup Chicago
Dojo Basics Js UserGroup Chicago
 
Organizing Code with JavascriptMVC
Organizing Code with JavascriptMVCOrganizing Code with JavascriptMVC
Organizing Code with JavascriptMVC
 
Txjs
TxjsTxjs
Txjs
 
Dojo >= 1.7 Kickstart
Dojo >= 1.7  KickstartDojo >= 1.7  Kickstart
Dojo >= 1.7 Kickstart
 
Tornadoweb
TornadowebTornadoweb
Tornadoweb
 
Dojo Confessions
Dojo ConfessionsDojo Confessions
Dojo Confessions
 
Week 4 - jQuery + Ajax
Week 4 - jQuery + AjaxWeek 4 - jQuery + Ajax
Week 4 - jQuery + Ajax
 
Web Crawling with NodeJS
Web Crawling with NodeJSWeb Crawling with NodeJS
Web Crawling with NodeJS
 
kissy-past-now-future
kissy-past-now-futurekissy-past-now-future
kissy-past-now-future
 
KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天
 
Building Dojo in the Cloud
Building Dojo in the CloudBuilding Dojo in the Cloud
Building Dojo in the Cloud
 
Inside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source DatabaseInside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source Database
 
How DRY impacts JavaScript performance // Faster JavaScript execution for the...
How DRY impacts JavaScript performance // Faster JavaScript execution for the...How DRY impacts JavaScript performance // Faster JavaScript execution for the...
How DRY impacts JavaScript performance // Faster JavaScript execution for the...
 
Intro to HTML5 Web Storage
Intro to HTML5 Web StorageIntro to HTML5 Web Storage
Intro to HTML5 Web Storage
 
How dojo works
How dojo worksHow dojo works
How dojo works
 
jQuery Learning
jQuery LearningjQuery Learning
jQuery Learning
 
The Dojo Toolkit An Introduction
The Dojo Toolkit   An IntroductionThe Dojo Toolkit   An Introduction
The Dojo Toolkit An Introduction
 

Recently uploaded

A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
UiPathCommunity
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 

Recently uploaded (20)

A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 

dojo.things()

  • 1. dojo.things() Peter Higgins (dante) Dojo Toolkit Project Lead ZendCon 2009 (#zendcon) October 19 - 23 Thursday, October 22, 2009
  • 2. me. http://twitter.com/phiggins http://dante.dojotoolkit.org http://joind.in/936 Thursday, October 22, 2009
  • 4. The History of Dojo (über-cliffnote version) Thursday, October 22, 2009
  • 6. A Team. http://demos.dojotoolkit.org/demos/skew/ Thursday, October 22, 2009
  • 7. The Dojo Toolkit • Long standing Development • Friendly Professional Community • Liberally Licensed, Clean IP http://dojotoolkit.org http://dojofoundation.org Thursday, October 22, 2009
  • 8. What is Dojo? • Unified JavaScript Toolkit - Supafast Light-weight Base (6k - 30k) - Package System - Use at will Library - Countless tools - Exposed Foundations - Defined deprecation policies - Defined release policies Thursday, October 22, 2009
  • 11. Base Dojo (aka: dojo.js) Thursday, October 22, 2009
  • 12. <?php echo $this->dojo() ?> Thursday, October 22, 2009
  • 13. What you get: • DOM: - byId, attr, place, clone, create, empty, position • CSS: - style, addClass, removeClass, toggleClass, hasClass • Ajax: - xhr, xhrGet/Post/Delete/Put, Deferred • Language: - connect, hitch, partial, delegate, declare, mixin, extend • Array: - forEach, map, filter, indexOf, lastIndexOf, some, every • JSON: - toJson, fromJson, queryToObject, objectToQuery, formToJson/Object/Query • FX: - Color Animations, anim, animateProperty, fadeIn/Out - http://download.dojotoolkit.org/current-stable/cheat.html Thursday, October 22, 2009
  • 14. dojo.query / dojo.NodeList • Fastest available Selector Engine - “Acme” • 1:1 pairing with dojo.* functions - dojo.style(“nodeid”, { props }) // fast - dojo.query(“#nodeid”).style({ props }) // sugar • Syntatic Sugar for events: - dojo.query(“.bar”).onclick(fnA).onmouseenter(fnB) Thursday, October 22, 2009
  • 15. Dojo Plugins // give all NodeList instances a hash of new functions: dojo.extend(dojo.NodeList, { color: function(color){ // set nodes to a color. getter/setter: return this.style(“color”, color); }, html: function(markup){ // set the HTML to some passed markup snippet return this.forEach(function(n){ n.innerHTML = markup; }); } }); Thursday, October 22, 2009
  • 16. Bling. (function($){ $(“#foo .bar”) .onclick(function(e){ // normalized ‘e’ }) .forEach(function(n){ // closed ‘n’ dojo.attr(n, “title”, “Touched”) }) .attr(“title”, “ReTouched!”) ; })(dojo.query); Thursday, October 22, 2009
  • 17. Package Basics • API: - provide(module) - require(module) - platformRequire(platform, module) - requireIf(someCondition, module) - registerModulePath(namespace, path) Thursday, October 22, 2009
  • 18. With Zend Framework ... // teh php: $this->dojo()->enable() ->registerModulePath(“myns”, “../myns”) ->requireModule(“myns.plugin”); // and js: ../myns/plugin.js dojo.provide(“myns.plugin”); (function($, d){ d.extend(d.NodeList, { ... }); d.declare(“myns.Thing”, null, { template: d.cache(“myns”, “templates/Thing.html”), constructor: function(args, node){ d.mixin(this, args); d.place(this.template, node, “replace”); } }); })(dojo.query, dojo); Thursday, October 22, 2009
  • 19. Using “layers” // teh php: $this->dojo()->enable() ->registerModulePath(“myns”, “../myns”) ->requireModule(“myns.kernel”); // or: $view->dojo()->addLayer(“/js/myns/kernel.js”); // and js: ../myns/kernel.js dojo.provide(“myns.kernel”); dojo.require(“myns.stuff”); dojo.require(“dojox.image.LightboxNano”); dojo.require(“myns.FirstWidget”); Thursday, October 22, 2009
  • 20. Ajax is eaaaaasy • All route through dojo.xhr(verb, kwArgs) • Common dojo.Deferred interface • Definable custom content handlers Thursday, October 22, 2009
  • 21. Ajax is eaaaaasy // basic. dojo.xhrGet({ url:”/foo”, load: function(data){ dojo.byId(“bar”).innerHTML = data; } }); // direct dfd var inflight = dojo.xhrGet({ url:”/foo” }) .addCallback(function(data){ ... }) .addErrback(function(error){ ... }) ; // alternate content-type: dojo.xhrPost({ url:”/foo/bar”, handleAs:”json”, load: function(data){ for(var i in data){ ... } } }); Thursday, October 22, 2009
  • 22. Custom Content Handlers // define the content-handler dojo.mixin(dojo.contentHandlers, { loadInto: function(xhr){ var n = dojo.byId(xhr.ioArgs.node); n.innerHTML = xhr.responseText; } }); // use the content-handler dojo.xhrGet({ url:”/foo”, handleAs:”loadInto”, node:”someId” }); Thursday, October 22, 2009
  • 23. Events • dojo.connect - DOM or Functional - Built-in scoping (everywhere!) - Explicit disconnect • Topics - publish/subscribe/unsubscribe Thursday, October 22, 2009
  • 24. Events var n = dojo.byId(“foo”); // plain ole’ onclick dojo.connect(n, “click”, function(e){ ... }); // calls thisObj.method(e) in scope of thisObj dojo.connect(n, “mouseenter”, thisObj, “method”); // anonymous with scope dojo.connect(n, “keydown”, thisObj, function(e){ // “this” == thisObj }); // with query: dojo.query(“#foo”) .onclick(function(e){ }) .onmouseenter(thisObj, “method”) .onkeydown(thisObj, function(e){ ... }) ; Thursday, October 22, 2009
  • 25. Topics // same hitching pattern: dojo.subscribe(“/are/you/listening”, function(a, b, c){ ... }); dojo.subscribe(“/are/you/listening”, thisObj, “method”); dojo.subscribe(“/are/you/listening”, thisObj, function(){ ... }); // trigger it all dojo.publish(“/are/you/listening”, [1, 2, 3]); Thursday, October 22, 2009
  • 26. hitch() // mini singleton var myObj = { counter:0, addOne: function(){ this.counter++; } } // more hitching pattern: dojo.connect(n, “onclick”, myObj, “addOne”); dojo.subscribe(“/who/knows”, myObj, “addOne”); var adder = dojo.hitch(myObj, “addOne”); dojo.connect(n, “mouseenter”, adder); Thursday, October 22, 2009
  • 27. hitch() for Classes dojo.declare(“my.Thing”, null, { url:”/foo”, message:””, loader: function(){ dojo.xhrGet({ url: this.url, load: dojo.hitch(this, “handler”) }) }, handler: function(data){ this.message = data; } }); var mt = new my.Thing(); mt.loader(); Thursday, October 22, 2009
  • 28. FX • dojo.animateProperty(kwArgs) • dojo.anim(node, props, ...) • dojo.fadeOut(kwArgs) • dojo.fadeIn(kwArgs) • new dojo.Animation(kwArgs) Thursday, October 22, 2009
  • 29. Animation Events var anim = dojo.fadeOut({ node:”bar” }); dojo.connect(anim, “onEnd”, function(n){ // animation is done }); dojo.connect(anim, “beforeBegin”, function(n){ // animation starts after this }); dojo.connect(anim, “onBegin”, function(n){ // animation just started }); anim.play(); // also onAnimate, onPlay, onStop, etc. dojo.fadeOut({ node:”baz”, onEnd:function(n){ /* inline, too */ }).play(); Thursday, October 22, 2009
  • 30. FX++ • dojo.require(“dojo.fx”); // or dojox.fx ... • dojo.fx.chain([animations]) • dojo.fx.combine([animations]); • dojo.fx.wipeIn/Out/slideIn/Out/etc Thursday, October 22, 2009
  • 32. dojo.require() away • dojo.data - Common API for data handling • Advanced I/O - dojo.io.script, dojo.io.iframe ... • dojo.cookie • dojo.behavior! Thursday, October 22, 2009
  • 33. Behavior? dojo.behavior.add({ “.foo .bar”: function(n){ // newly found }, “#baz”:{ “found”: function(n){ // also newly found }, “onclick”: function(e){ // handler } } }); dojo.behavior.apply(); Live behaviors available in `plugd` Thursday, October 22, 2009
  • 35. Dijit (Dojo Widgets) Thursday, October 22, 2009
  • 36. Dijit widget system • dijit._Widget / dijit._Templated / etc • dijit.Dialog / dijit.layout.TabContainer / etc • dijit.form.ValidationTextBox / etc Thursday, October 22, 2009
  • 37. Declarative vs Programatic new dijit.Dialog({ title:”Hi There”, href:”/foo/bar”, id:”bar” }); <!-- same as: --> <div id=”bar” dojoType=”dijit.Dialog” title=”Hi There” href=”/foo/bar”></div> Thursday, October 22, 2009
  • 38. Declarative vs Programatic Zend_Dojo_View_Helper_Dojo::setUseDeclarative(); Zend_Dojo_View_Helper_Dojo::setUseProgrammatic(); Zend_Dojo_View_Helper_Dojo::setUseProgrammatic(-1); Thursday, October 22, 2009
  • 39. customDijit FTW! // consider: new my.Thing({ someAttribute:”something” }, “nodeid”) // versus: <div dojoType=”my.Thing” someAttribute=”something” id=”nodeid”> <p>Inner Content</p> </div> // in PHP: <?php $this->customDijit()->captureStart( ‘baaar’, array( dojoType => “my.Thing”, someAttribute => “something” ) ); ?> <p>Inner Content</p> <? php echo $this->customDijit()->captureEnd(‘baaar’); ?> Thursday, October 22, 2009
  • 40. DojoX (X !== experimental) Thursday, October 22, 2009
  • 41. DojoX, briefly. • Sandbox • Cutting Edge • Un-categorized Thursday, October 22, 2009
  • 42. DojoX, briefly. • dojox.gfx • dojox.charting • dojox.cometd / org.cometd • dojox.grid • dojox.widget / dojox.layout / dojox.form • dojox.image • dojox.data • dojox.rpc / SMD Thursday, October 22, 2009
  • 43. RPC / SMD dojo.require(“dojox.rpc.Service”); var goog = new dojox.rpc.Service(“google.smd”); goog.websearch({ q:”Dojo” }).addCallback(function(response){ // handle the responses }); goog.booksearch({ q:”Dojo” }).addBoth(function(response){ // Books about Dojo }); Thursday, October 22, 2009
  • 44. dojox.data Stores: • AndOrReadStore • FlickrRestStore / • AppStore FlickrStore • AtomReadStore • GoogleFeedStore • CouchDBRestStore • GoogleSearchStore • CssRuleStore • HtmlStore • CsvStore • jsonPathStore • FileStore • jsonRestStore • OpmlStore Thursday, October 22, 2009
  • 45. Dojo Build System Thursday, October 22, 2009
  • 46. All-in-One • Works transparently with Package System • Group modules into ‘layers’ • Concatenate CSS @import into ‘layers’ • Layer & File minification - Comments, Whitespace, newlines ... • stripConsole (console.warn, .log, .error) Thursday, October 22, 2009
  • 47. #ifdef in JavaScript? // the code: //>>excludeStart(“something”, kwArgs.condition == true); /* code to exclude */ //>>excludeStop(“something”); # exclude it: ./build.sh condition=true profile=myprofile Thursday, October 22, 2009
  • 48. Development Debugging // ... handler: function(data){ if(data && !data.error){ /* do something with the data */ } //>>excludeStart(“debuggykins”, true); else{ console.warn(“We require data, and didn’t get it.”); console.log(“got:”, arguments); } //>>excludeStop(“debuggykins”); }, // ... Thursday, October 22, 2009
  • 49. Special Builds • Stubs (6k dojo.js) • Base++ (dojo.js with modules) • Cross-Domain • plugd • Scope Burning Thursday, October 22, 2009
  • 51. scopeMap + kwArgs // Dojo? Moo.load(function(){ place("<p>Hello, Moojo</p>", "container"); query("p") .style("fontSize", "10px") .animate({ fontSize:{ end: 42 } }) ; }); http://dante.dojotoolkit.org/static/otherlibs/moojo.html Thursday, October 22, 2009
  • 52. //>>excludeStart(“auto”, kwArgs.autoConflict == “on”) if(dojo.config.conflict){ //>>excludeStop(“auto”) // exportNS is a plugd plugin dojo.exportNS(dojo, dojo.global); //>>excludeStart(“auto”, kwArgs.autoConflict == “on”) } //>>excludeStop(“auto”) http://dante.dojotoolkit.org/static/otherlibs/moojo.html Thursday, October 22, 2009
  • 54. Gracias. (me, again) dante@dojotoolkit.org http://twitter.com/phiggins http://higginsforpresident.net/ http://dante.dojotoolkit.org http://joind.in/936 Thursday, October 22, 2009
  • 55. Some resources: http://dojotoolkit.org http://dojocampus.org/explorer http://dojocampus.org http://download.dojotoolkit.org http://docs.dojocampus.org http://demos.dojotoolkit.org Thursday, October 22, 2009