Changeset 807
- Timestamp:
- 04/28/06 08:13:31 (2 years ago)
- Files:
-
- presentations/2006/ajax_experience/slides.html (modified) (46 diffs)
- presentations/2006/ajax_experience/slides.txt (modified) (54 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
presentations/2006/ajax_experience/slides.html
r805 r807 359 359 <ul class="simple"> 360 360 <li><a class="reference" href="#what-s-mochikit" id="id1" name="id1">What's MochiKit?</a></li> 361 <li><a class="reference" href="#another-library" id="id2" name="id2">Another library?!</a></li>361 <li><a class="reference" href="#another-library" id="id2" name="id2">Another Library?!</a></li> 362 362 <li><a class="reference" href="#mochikit-design-goals" id="id3" name="id3">MochiKit Design Goals</a></li> 363 363 <li><a class="reference" href="#why-mochikit" id="id4" name="id4">Why MochiKit?</a></li> 364 <li><a class="reference" href="#why-not-mochikit" id="id5" name="id5">Why not MochiKit?</a></li>364 <li><a class="reference" href="#why-not-mochikit" id="id5" name="id5">Why Not MochiKit?</a></li> 365 365 <li><a class="reference" href="#mochikit-base" id="id6" name="id6">MochiKit.Base</a></li> 366 <li><a class="reference" href="#tostring-ambiguity" id="id7" name="id7">toString ambiguity</a></li>366 <li><a class="reference" href="#tostring-ambiguity" id="id7" name="id7">toString Ambiguity</a></li> 367 367 <li><a class="reference" href="#repr-tostring" id="id8" name="id8">repr > toString</a></li> 368 368 <li><a class="reference" href="#mochikit-interpreter" id="id9" name="id9">MochiKit Interpreter</a></li> 369 <li><a class="reference" href="# compare-instead-of-operators" id="id10" name="id10">compare instead of operators</a></li>370 <li><a class="reference" href="#json-serialization" id="id11" name="id11">JSON serialization</a></li>371 <li><a class="reference" href="# wait-adapters" id="id12" name="id12">Wait..Adapters?</a></li>372 <li><a class="reference" href="# registering-an-adapter" id="id13" name="id13">Registering an adapter</a></li>373 <li><a class="reference" href="#dom-comparator-example" id="id14" name="id14">DOM comparator example</a></li>369 <li><a class="reference" href="#unreliable-operators" id="id10" name="id10">Unreliable Operators</a></li> 370 <li><a class="reference" href="#json-serialization" id="id11" name="id11">JSON Serialization</a></li> 371 <li><a class="reference" href="#adapters" id="id12" name="id12">Adapters?</a></li> 372 <li><a class="reference" href="#adapting" id="id13" name="id13">Adapting</a></li> 373 <li><a class="reference" href="#dom-comparator-example" id="id14" name="id14">DOM Comparator Example</a></li> 374 374 <li><a class="reference" href="#querystring" id="id15" name="id15">queryString</a></li> 375 <li><a class="reference" href="# mangling-objects" id="id16" name="id16">Mangling Objects</a></li>376 <li><a class="reference" href="# object-introspection" id="id17" name="id17">Object Introspection</a></li>377 <li><a class="reference" href="# function-functions" id="id18" name="id18">Function functions</a></li>378 <li><a class="reference" href="# basic-array-functions" id="id19" name="id19">Basic Array functions</a></li>379 <li><a class="reference" href="# compare-based-array-functions" id="id20" name="id20">compare-based Array functions</a></li>380 <li><a class="reference" href="# higher-order-array-functions" id="id21" name="id21">Higher-order Array functions</a></li>381 <li><a class="reference" href="# mochikit-iter" id="id22" name="id22">MochiKit.Iter</a></li>382 <li><a class="reference" href="# collapsing-iterators" id="id23" name="id23">Collapsing Iterators</a></li>383 <li><a class="reference" href="# iterating-iterables" id="id24" name="id24">Iterating Iterables</a></li>384 <li><a class="reference" href="# sane-iterable-iteration" id="id25" name="id25">Sane Iterable Iteration</a></li>385 <li><a class="reference" href="# infinite-iterators" id="id26" name="id26">Infinite Iterators</a></li>386 <li><a class="reference" href="# should-i-care-about-iter" id="id27" name="id27">Should I care about Iter?</a></li>375 <li><a class="reference" href="#querystring-and-dom" id="id16" name="id16">queryString and DOM</a></li> 376 <li><a class="reference" href="#mangling-objects" id="id17" name="id17">Mangling Objects</a></li> 377 <li><a class="reference" href="#object-introspection" id="id18" name="id18">Object Introspection</a></li> 378 <li><a class="reference" href="#function-functions" id="id19" name="id19">Function Functions</a></li> 379 <li><a class="reference" href="#array-functions" id="id20" name="id20">Array Functions</a></li> 380 <li><a class="reference" href="#array-searching" id="id21" name="id21">Array Searching</a></li> 381 <li><a class="reference" href="#higher-order-array" id="id22" name="id22">Higher-order Array</a></li> 382 <li><a class="reference" href="#mochikit-iter" id="id23" name="id23">MochiKit.Iter</a></li> 383 <li><a class="reference" href="#collapsing-iterators" id="id24" name="id24">Collapsing Iterators</a></li> 384 <li><a class="reference" href="#iterating-iterables" id="id25" name="id25">Iterating Iterables</a></li> 385 <li><a class="reference" href="#sane-iterable-iteration" id="id26" name="id26">Sane Iterable Iteration</a></li> 386 <li><a class="reference" href="#infinite-iterators" id="id27" name="id27">Infinite Iterators</a></li> 387 387 <li><a class="reference" href="#mochikit-datetime" id="id28" name="id28">MochiKit.DateTime</a></li> 388 388 <li><a class="reference" href="#iso-dates" id="id29" name="id29">ISO Dates</a></li> 389 <li><a class="reference" href="# silly-american-dates" id="id30" name="id30">SillyAmerican Dates</a></li>389 <li><a class="reference" href="#american-dates" id="id30" name="id30">American Dates</a></li> 390 390 <li><a class="reference" href="#time-and-timestamps" id="id31" name="id31">Time and Timestamps</a></li> 391 391 <li><a class="reference" href="#mochikit-format" id="id32" name="id32">MochiKit.Format</a></li> 392 <li><a class="reference" href="# simple-string-mangling" id="id33" name="id33">Simple String Mangling</a></li>392 <li><a class="reference" href="#whitespace-assassins" id="id33" name="id33">Whitespace Assassins</a></li> 393 393 <li><a class="reference" href="#number-formatting" id="id34" name="id34">Number Formatting</a></li> 394 <li><a class="reference" href="#number-formatter-examples" id="id35" name="id35">Number Formatter Examples</a></li> 395 <li><a class="reference" href="#mochikit-logging" id="id36" name="id36">MochiKit.Logging</a></li> 396 <li><a class="reference" href="#simple-logging" id="id37" name="id37">Simple logging</a></li> 397 <li><a class="reference" href="#where-d-my-log-messages-go" id="id38" name="id38">Where'd my log messages go?</a></li> 398 <li><a class="reference" href="#bookmarklet-debugging" id="id39" name="id39">Bookmarklet Debugging</a></li> 399 <li><a class="reference" href="#mochikit-loggingpane" id="id40" name="id40">MochiKit.LoggingPane</a></li> 400 <li><a class="reference" href="#manually-creating-a-loggingpane" id="id41" name="id41">Manually creating a LoggingPane</a></li> 401 <li><a class="reference" href="#inline-loggingpane-example" id="id42" name="id42">Inline LoggingPane Example</a></li> 402 <li><a class="reference" href="#mochikit-dom" id="id43" name="id43">MochiKit.DOM</a></li> 403 <li><a class="reference" href="#createdom" id="id44" name="id44">createDOM</a></li> 404 <li><a class="reference" href="#createdom-example" id="id45" name="id45">createDOM example</a></li> 405 <li><a class="reference" href="#but-that-s-still-ugly" id="id46" name="id46">But that's still ugly...</a></li> 406 <li><a class="reference" href="#flattening-lists" id="id47" name="id47">Flattening lists</a></li> 407 <li><a class="reference" href="#what-about-attributes" id="id48" name="id48">What about attributes?</a></li> 408 <li><a class="reference" href="#alternating-classes" id="id49" name="id49">Alternating classes</a></li> 409 <li><a class="reference" href="#mochikit-interpreter-again" id="id50" name="id50">MochiKit Interpreter (Again)</a></li> 410 <li><a class="reference" href="#scraping-text" id="id51" name="id51">Scraping text</a></li> 411 <li><a class="reference" href="#reading-forms" id="id52" name="id52">Reading forms</a></li> 412 <li><a class="reference" href="#manipulating-dom-nodes" id="id53" name="id53">Manipulating DOM nodes</a></li> 413 <li><a class="reference" href="#manipulating-dom-attributes" id="id54" name="id54">Manipulating DOM attributes</a></li> 414 <li><a class="reference" href="#dom-gotchas" id="id55" name="id55">DOM Gotchas</a></li> 415 <li><a class="reference" href="#mochikit-color" id="id56" name="id56">MochiKit.Color</a></li> 416 <li><a class="reference" href="#creating-colors-from-components" id="id57" name="id57">Creating colors from components</a></li> 417 <li><a class="reference" href="#creating-colors-from-strings" id="id58" name="id58">Creating colors from strings</a></li> 418 <li><a class="reference" href="#creating-colors-from-dom-elements" id="id59" name="id59">Creating colors from DOM elements</a></li> 419 <li><a class="reference" href="#built-in-nscolor-colors" id="id60" name="id60">Built-in NSColor colors</a></li> 420 <li><a class="reference" href="#mixing-colors" id="id61" name="id61">Mixing colors</a></li> 421 <li><a class="reference" href="#getting-color-values" id="id62" name="id62">Getting color values</a></li> 422 <li><a class="reference" href="#mochikit-async" id="id63" name="id63">MochiKit.Async</a></li> 423 <li><a class="reference" href="#wtf-is-a-deferred" id="id64" name="id64">WTF is a Deferred?</a></li> 424 <li><a class="reference" href="#trivial-deferreds" id="id65" name="id65">Trivial Deferreds</a></li> 425 <li><a class="reference" href="#timed-events" id="id66" name="id66">Timed Events</a></li> 426 <li><a class="reference" href="#network-events" id="id67" name="id67">Network Events</a></li> 427 <li><a class="reference" href="#deferred-usage" id="id68" name="id68">Deferred Usage</a></li> 428 <li><a class="reference" href="#result-chaining" id="id69" name="id69">Result Chaining</a></li> 429 <li><a class="reference" href="#deferred-chaining" id="id70" name="id70">Deferred Chaining</a></li> 430 <li><a class="reference" href="#mochikit-signal" id="id71" name="id71">MochiKit.Signal</a></li> 431 <li><a class="reference" href="#what-sucks-about-browser-events" id="id72" name="id72">What sucks about browser events?</a></li> 432 <li><a class="reference" href="#connect-to-the-dom" id="id73" name="id73">connect to the DOM</a></li> 433 <li><a class="reference" href="#custom-event-object" id="id74" name="id74">Custom Event Object</a></li> 434 <li><a class="reference" href="#mouse-events" id="id75" name="id75">Mouse Events</a></li> 435 <li><a class="reference" href="#keyboard-events" id="id76" name="id76">Keyboard Events</a></li> 436 <li><a class="reference" href="#signal-anything" id="id77" name="id77">Signal Anything</a></li> 437 <li><a class="reference" href="#mochikit-support" id="id78" name="id78">MochiKit Support</a></li> 438 <li><a class="reference" href="#mochikit-on-the-web" id="id79" name="id79">MochiKit on the Web</a></li> 394 <li><a class="reference" href="#currency-formatter-example" id="id35" name="id35">Currency Formatter Example</a></li> 395 <li><a class="reference" href="#percent-formatter-example" id="id36" name="id36">Percent Formatter Example</a></li> 396 <li><a class="reference" href="#mochikit-logging" id="id37" name="id37">MochiKit.Logging</a></li> 397 <li><a class="reference" href="#simple-logging" id="id38" name="id38">Simple Logging</a></li> 398 <li><a class="reference" href="#logs-are-where" id="id39" name="id39">Logs Are Where?</a></li> 399 <li><a class="reference" href="#bookmarklet-debugging" id="id40" name="id40">Bookmarklet Debugging</a></li> 400 <li><a class="reference" href="#mochikit-loggingpane" id="id41" name="id41">MochiKit.LoggingPane</a></li> 401 <li><a class="reference" href="#manually-creating-a-loggingpane" id="id42" name="id42">Manually creating a LoggingPane</a></li> 402 <li><a class="reference" href="#inline-loggingpane-example" id="id43" name="id43">Inline LoggingPane Example</a></li> 403 <li><a class="reference" href="#mochikit-dom" id="id44" name="id44">MochiKit.DOM</a></li> 404 <li><a class="reference" href="#createdom" id="id45" name="id45">createDOM</a></li> 405 <li><a class="reference" href="#createdom-example" id="id46" name="id46">createDOM Example</a></li> 406 <li><a class="reference" href="#less-ugly" id="id47" name="id47">Less Ugly</a></li> 407 <li><a class="reference" href="#flattening-for-the-dom" id="id48" name="id48">Flattening for the DOM</a></li> 408 <li><a class="reference" href="#attributes" id="id49" name="id49">Attributes</a></li> 409 <li><a class="reference" href="#alternating" id="id50" name="id50">Alternating</a></li> 410 <li><a class="reference" href="#mochikit-interpreter-again" id="id51" name="id51">MochiKit Interpreter (Again)</a></li> 411 <li><a class="reference" href="#scraping-text" id="id52" name="id52">Scraping Text</a></li> 412 <li><a class="reference" href="#forms" id="id53" name="id53">Forms</a></li> 413 <li><a class="reference" href="#manipulating-dom" id="id54" name="id54">Manipulating DOM</a></li> 414 <li><a class="reference" href="#dom-attributes" id="id55" name="id55">DOM Attributes</a></li> 415 <li><a class="reference" href="#dom-gotchas" id="id56" name="id56">DOM Gotchas</a></li> 416 <li><a class="reference" href="#mochikit-color" id="id57" name="id57">MochiKit.Color</a></li> 417 <li><a class="reference" href="#components-to-color" id="id58" name="id58">Components to Color</a></li> 418 <li><a class="reference" href="#string-to-color" id="id59" name="id59">String to Color</a></li> 419 <li><a class="reference" href="#dom-to-color" id="id60" name="id60">DOM to Color</a></li> 420 <li><a class="reference" href="#nscolor-colors" id="id61" name="id61">NSColor colors</a></li> 421 <li><a class="reference" href="#mixing-colors" id="id62" name="id62">Mixing colors</a></li> 422 <li><a class="reference" href="#color-components" id="id63" name="id63">Color Components</a></li> 423 <li><a class="reference" href="#mochikit-async" id="id64" name="id64">MochiKit.Async</a></li> 424 <li><a class="reference" href="#wtf-is-a-deferred" id="id65" name="id65">WTF is a Deferred?</a></li> 425 <li><a class="reference" href="#trivial-deferreds" id="id66" name="id66">Trivial Deferreds</a></li> 426 <li><a class="reference" href="#timed-events" id="id67" name="id67">Timed Events</a></li> 427 <li><a class="reference" href="#network-events" id="id68" name="id68">Network Events</a></li> 428 <li><a class="reference" href="#deferred-usage" id="id69" name="id69">Deferred Usage</a></li> 429 <li><a class="reference" href="#result-chaining" id="id70" name="id70">Result Chaining</a></li> 430 <li><a class="reference" href="#deferred-chaining" id="id71" name="id71">Deferred Chaining</a></li> 431 <li><a class="reference" href="#mochikit-signal" id="id72" name="id72">MochiKit.Signal</a></li> 432 <li><a class="reference" href="#browser-events-suck" id="id73" name="id73">Browser Events Suck</a></li> 433 <li><a class="reference" href="#connect-to-the-dom" id="id74" name="id74">connect to the DOM</a></li> 434 <li><a class="reference" href="#custom-event-object" id="id75" name="id75">Custom Event Object</a></li> 435 <li><a class="reference" href="#mouse-events" id="id76" name="id76">Mouse Events</a></li> 436 <li><a class="reference" href="#keyboard-events" id="id77" name="id77">Keyboard Events</a></li> 437 <li><a class="reference" href="#signal-anything" id="id78" name="id78">Signal Anything</a></li> 438 <li><a class="reference" href="#mochikit-support" id="id79" name="id79">MochiKit Support</a></li> 439 <li><a class="reference" href="#mochikit-on-the-web" id="id80" name="id80">MochiKit on the Web</a></li> 439 440 </ul> 440 441 </div> … … 451 452 </div> 452 453 <div class="slide" id="another-library"> 453 <h1>Another library?!</h1> 454 <ul class="simple"> 455 <li>Prototype was undocumented, no tests, didn't play nice</li> 456 <li>Dojo had no documentation or demos</li> 457 <li>Everything else was outdated, not liberally licensed, 458 not cross-platform</li> 459 </ul> 454 <h1>Another Library?!</h1> 455 <p>(July 2005)</p> 456 <dl class="docutils"> 457 <dt>Prototype:</dt> 458 <dd>no docs or tests, mangles built-ins</dd> 459 <dt>Dojo:</dt> 460 <dd>no docs or demos</dd> 461 </dl> 460 462 </div> 461 463 <div class="slide" id="mochikit-design-goals"> … … 464 466 <li>Documentation</li> 465 467 <li>DOCUMENTATION</li> 466 <li> Test early test often</li>468 <li>Lots of tests</li> 467 469 <li>Stay out of the way (not a framework)</li> 468 <li>Consistent</li> 469 <li>Portable</li> 470 <li>Workaround browser stupidity</li> 470 <li>Consistent and portable</li> 471 471 </ul> 472 472 </div> … … 474 474 <h1>Why MochiKit?</h1> 475 475 <ul class="simple"> 476 <li>Extremely well documented, tested, stable</li> 476 <li>Good docs, well tested</li> 477 <li>Async abstractions</li> 478 <li>Painless DOM syntax</li> 479 <li>Consistent browser events</li> 480 <li>Python-like (think "standard library")</li> 477 481 <li>Safari 2.0, Firefox 1.0, IE 6, Opera 8.5 (and others)</li> 478 <li>Abstracts async behavior</li>479 <li>MochiKit.DOM syntax makes DOM painless</li>480 <li>MochiKit.Signal works around LOTS of browser misfeatures</li>481 <li>Python-like (think "standard library")</li>482 482 </ul> 483 483 </div> 484 484 <div class="slide" id="why-not-mochikit"> 485 <h1>Why not MochiKit?</h1>485 <h1>Why Not MochiKit?</h1> 486 486 <ul class="simple"> 487 487 <li>No support for IE 5.5</li> 488 488 <li>No widgets</li> 489 489 <li>No animation, transitions, etc.</li> 490 <li>... but we're working on a Scriptaculous port (MochiKit 1.4)</li>490 <li>... MochiKit 1.4</li> 491 491 </ul> 492 492 </div> … … 500 500 </div> 501 501 <div class="slide" id="tostring-ambiguity"> 502 <h1>toString ambiguity</h1> 503 <ul> 504 <li><p class="first">Which one of these things is not like the other:</p> 505 <blockquote> 506 <ul class="simple"> 507 <li>[1]</li> 508 <li>1.0</li> 509 <li>"1"</li> 510 </ul> 511 </blockquote> 512 </li> 513 <li><p class="first">They're all the same according to JavaScript's toString! Totally useless 514 for debugging.</p> 515 </li> 502 <h1>toString Ambiguity</h1> 503 <ul class="simple"> 504 <li>[1].toString() === "1"</li> 505 <li>(1).toString() === "1"</li> 506 <li>"1".toString() === "1"</li> 516 507 </ul> 517 508 </div> 518 509 <div class="slide" id="repr-tostring"> 519 510 <h1>repr > toString</h1> 520 <ul> 521 <li><p class="first">MochiKit provides repr() instead, just like Python. 522 Think "programmer representation".</p> 523 <blockquote> 524 <ul class="simple"> 525 <li>repr([1]) == "[1]"</li> 526 <li>repr(1.0) == "1"</li> 527 <li>repr("1") == ""1""</li> 528 </ul> 529 </blockquote> 530 </li> 531 <li><p class="first">repr understands primitive types, objects that implement <tt class="docutils literal"><span class="pre">repr</span></tt> or 532 <tt class="docutils literal"><span class="pre">__repr__</span></tt></p> 533 </li> 511 <ul class="simple"> 512 <li>MochiKit provides repr() instead, just like Python.</li> 513 <li>Unambiguous, extensible</li> 534 514 </ul> 535 515 </div> … … 548 528 <script type="text/javascript" src="ui/mochikit/examples/interpreter.js"></script> 549 529 </div> 550 <div class="slide" id="compare-instead-of-operators"> 551 <h1>compare instead of operators</h1> 552 <ul class="simple"> 553 <li>JavaScript comparisons are WHACK (these are <tt class="docutils literal"><span class="pre">true</span></tt>!)<ul> 554 <li>[1,"2"] == "1,2"</li> 555 <li>([""] == "") && ([] == "") && ([] != [""])</li> 556 </ul> 557 </li> 558 <li>compare(a, b) provides consistent results<ul> 559 <li>Usable with Array.prototype.sort</li> 560 <li>Understands String, Date, Array, Number, String, ...</li> 561 <li>Can be extended with adapter registry</li> 562 </ul> 563 </li> 530 <div class="slide" id="unreliable-operators"> 531 <h1>Unreliable Operators</h1> 532 <ul class="simple"> 533 <li>Most JavaScript comparisons based on toString</li> 534 <li>Ambiguous, unreliable</li> 535 <li>compare(a, b) provides consistent results</li> 536 <li>Extensible</li> 564 537 </ul> 565 538 </div> 566 539 <div class="slide" id="json-serialization"> 567 <h1>JSON serialization</h1> 568 <ul class="simple"> 569 <li>serializeJSON(object) -> JSON string<ul> 570 <li>Understands primitive types</li> 571 <li>Will call <tt class="docutils literal"><span class="pre">json</span></tt> or <tt class="docutils literal"><span class="pre">__json__</span></tt> on objects if method exists</li> 572 <li>Can be extended with adapter registry</li> 573 </ul> 574 </li> 575 </ul> 576 </div> 577 <div class="slide" id="wait-adapters"> 578 <h1>Wait.. Adapters?</h1> 540 <h1>JSON Serialization</h1> 541 <ul class="simple"> 542 <li>serializeJSON(object) -> JSON string</li> 543 <li>Extensible</li> 544 </ul> 545 </div> 546 <div class="slide" id="adapters"> 547 <h1>Adapters?</h1> 579 548 <ul class="simple"> 580 549 <li>Not a good idea to hack on built-in objects</li> 581 550 <li>MochiKit doesn't always know what you want to do</li> 582 <li>Adapters let you extend existing functions<ul> 583 <li>registerRepr</li> 584 <li>registerComparator</li> 585 <li>registerJSON</li> 586 </ul> 587 </li> 588 </ul> 589 </div> 590 <div class="slide" id="registering-an-adapter"> 591 <h1>Registering an adapter</h1> 551 <li>Adapters let you extend existing functions</li> 552 </ul> 553 </div> 554 <div class="slide" id="adapting"> 555 <h1>Adapting</h1> 592 556 <dl class="docutils"> 593 557 <dt>name:</dt> 594 <dd> a unique identifier for your adapter (can be used to unregister)</dd>558 <dd>unique identifier for your adapter</dd> 595 559 <dt>check:</dt> 596 <dd> apredicate, should wrap be called?</dd>560 <dd>predicate, should wrap be called?</dd> 597 561 <dt>wrap:</dt> 598 562 <dd>performs the operation</dd> … … 600 564 </div> 601 565 <div class="slide" id="dom-comparator-example"> 602 <h1>DOM comparator example</h1>566 <h1>DOM Comparator Example</h1> 603 567 <p>Register HTML-based comparator for DOM nodes:</p> 604 568 <pre class="literal-block"> … … 617 581 <div class="slide" id="querystring"> 618 582 <h1>queryString</h1> 583 <ul class="simple"> 584 <li>Easily build URL query strings</li> 585 <li>queryString(["foo", "bar"], [1, 2]) == "foo=1&bar=2"</li> 586 <li>queryString({foo: 1, bar: 2}) == "foo=1&bar=2"</li> 587 </ul> 588 </div> 589 <div class="slide" id="querystring-and-dom"> 590 <h1>queryString and DOM</h1> 619 591 <ul> 620 <li><p class="first">queryString(["foo", "bar"], [1, 2]) == "foo=1&bar=2"</p>621 </li>622 <li><p class="first">queryString({foo: 1, bar: 2}) == "foo=1&bar=2"</p>623 </li>624 592 <li><p class="first">queryString("formNode") == "foo=1&bar=2", given:</p> 625 593 <pre class="literal-block"> … … 636 604 <dl class="docutils"> 637 605 <dt>merge(obj[, ...]):</dt> 638 <dd>Create a new object consisting of every property in the given objects 639 (last object given takes precedence)</dd> 606 <dd>New object, every prop:value of given objects</dd> 640 607 <dt>update(obj[, ...]):</dt> 641 <dd>In-place version ofmerge</dd>608 <dd>In-place merge</dd> 642 609 <dt>updatetree(obj[, ...]):</dt> 643 <dd>Recursive version ofupdate</dd>610 <dd>Recursive update</dd> 644 611 <dt>setdefault(obj[, ...]):</dt> 645 <dd> Like update, but does NOT overwrite existing properties</dd>612 <dd>update, but no overwrite</dd> 646 613 </dl> 647 614 </div> … … 650 617 <dl class="docutils"> 651 618 <dt>keys(obj):</dt> 652 <dd> returns anArray of every property on obj</dd>619 <dd>Array of every property on obj</dd> 653 620 <dt>items(obj):</dt> 654 <dd> returns anArray of every [property, value] on obj</dd>621 <dd>Array of every [property, value] on obj</dd> 655 622 </dl> 656 623 </div> 657 624 <div class="slide" id="function-functions"> 658 <h1>Function functions</h1>625 <h1>Function Functions</h1> 659 626 <dl class="docutils"> 660 627 <dt>bind(fn, self[, arg...]):</dt> 661 <dd> new function, equivalent tofn.apply(self, concat(arg..., arguments))</dd>628 <dd>fn.apply(self, concat(arg..., arguments))</dd> 662 629 <dt>method(self, fn[, arg...]):</dt> 663 630 <dd>convenience form for bind</dd> 664 631 <dt>itemgetter(name):</dt> 665 <dd> new function(obj), equivalent toobj[name]</dd>666 </dl> 667 </div> 668 <div class="slide" id=" basic-array-functions">669 <h1> Basic Array functions</h1>670 <p>Array .prototype is missing lots of useful functions (cross-platform anyway)</p>632 <dd>obj[name]</dd> 633 </dl> 634 </div> 635 <div class="slide" id="array-functions"> 636 <h1>Array Functions</h1> 637 <p>Array missing lots of useful functionality</p> 671 638 <dl class="docutils"> 672 639 <dt>concat(lst[, ...]):</dt> … … 675 642 <dd>extends a list in-place</dd> 676 643 <dt>flattenArguments(args[, ...]):</dt> 677 <dd>Creates a flat Array from a bunch of arguments, recursively flattening 678 any Arrays that are encountered</dd> 679 </dl> 680 </div> 681 <div class="slide" id="compare-based-array-functions"> 682 <h1>compare-based Array functions</h1> 644 <dd>recursively flatten arguments to single Array</dd> 645 </dl> 646 </div> 647 <div class="slide" id="array-searching"> 648 <h1>Array Searching</h1> 683 649 <dl class="docutils"> 684 650 <dt>findValue(lst, value, start=0, end=lst.length):</dt> 685 651 <dd>finds index of value (using compare)</dd> 686 652 <dt>findIdentical(lst, value, start=0, end=lst.length):</dt> 687 <dd>finds index of value (using === for identity)</dd>653 <dd>finds index of value (using ===)</dd> 688 654 <dt>listMin(lst):</dt> 689 655 <dd>finds least item in lst (using compare)</dd> … … 692 658 </dl> 693 659 </div> 694 <div class="slide" id="higher-order-array -functions">695 <h1>Higher-order Array functions</h1>660 <div class="slide" id="higher-order-array"> 661 <h1>Higher-order Array</h1> 696 662 <dl class="docutils"> 697 663 <dt>filter(predicate, lst):</dt> … … 705 671 <div class="slide" id="mochikit-iter"> 706 672 <h1>MochiKit.Iter</h1> 707 <p>MochiKit.Iter provides generalized iteration, very similar toPython's673 <p>MochiKit.Iter provides generalized iteration, like Python's 708 674 iteration protocol and itertools module.</p> 709 675 <ul class="simple"> … … 711 677 <li>Anything with a <tt class="docutils literal"><span class="pre">next</span></tt> method is iterable, and the iteration stops when 712 678 StopIteration is thrown.</li> 713 <li>Objects can define an <tt class="docutils literal"><span class="pre">iter</span></tt> method to return an iterable</li> 714 <li>Can register adapters too, with registerIterable.</li> 679 <li>Extensible</li> 715 680 </ul> 716 681 </div> … … 719 684 <dl class="docutils"> 720 685 <dt>exhaust(iterable):</dt> 721 <dd>Iterate over <tt class="docutils literal"><span class="pre">iterable</span></tt> and throw away the results</dd>686 <dd>Iterate and ignore results</dd> 722 687 <dt>list(iterable):</dt> 723 <dd> Convert <tt class="docutils literal"><span class="pre">iterable</span></tt> to anew Array</dd>688 <dd>new Array</dd> 724 689 <dt>sorted(iterable, cmp=compare):</dt> 725 <dd> Return a sorted Array from <tt class="docutils literal"><span class="pre">iterable</span></tt> using <tt class="docutils literal"><span class="pre">cmp</span></tt> as the comparator</dd>690 <dd>sorted Array using cmp</dd> 726 691 <dt>sum(iterable, start=0):</dt> 727 <dd>Return the sum of each item in <tt class="docutils literal"><span class="pre">iterable</span></tt> plus the <tt class="docutils literal"><span class="pre">start</span></tt>.</dd>692 <dd>Return start plus sum of items</dd> 728 693 </dl> 729 694 </div> … … 756 721 <dl class="docutils"> 757 722 <dt>count(n=0):</dt> 758 <dd> Iterates over a sequence of numbers (n, n + 1, n + 2, ...)</dd>723 <dd>n, n + 1, n + 2, ...</dd> 759 724 <dt>cycle(iterable):</dt> 760 <dd>Iterates over iterable and saves the results. Once iterable is exhausted, 761 it iterates over the cached result Array indefinitely.</dd> 725 <dd>while (true) { iterable[0], ..., iterable[N] }</dd> 762 726 <dt>repeat(item):</dt> 763 <dd>Returns an iterator that returns item over and over, same as 764 cycle([item])</dd> 765 </dl> 766 </div> 767 <div class="slide" id="should-i-care-about-iter"> 768 <h1>Should I care about Iter?</h1> 769 <ul class="simple"> 770 <li>You don't need to understand it to understand MochiKit</li> 771 <li>Used primarily to simplify internal code, helps a lot with DOM generation</li> 772 <li>You might not need it, but it is convenient for people used to a more 773 functional paradigm</li> 774 <li>If you don't use itertools in Python, you probably won't directly use 775 much of MochiKit.Iter either</li> 776 </ul> 727 <dd>item, item, item, item, ...</dd> 728 </dl> 777 729 </div> 778 730 <div class="slide" id="mochikit-datetime"> … … 787 739 <dl class="docutils"> 788 740 <dt>isoDate(str):</dt> 789 <dd> Convert ISO 8601 date to a Date object</dd>741 <dd>Date object from ISO 8601 date string</dd> 790 742 <dt>toISODate(date):</dt> 791 <dd> Convert a Date object to an ISO 8601 date</dd>792 </dl> 793 </div> 794 <div class="slide" id=" silly-american-dates">795 <h1> SillyAmerican Dates</h1>743 <dd>Date object to ISO 8601 date string</dd> 744 </dl> 745 </div> 746 <div class="slide" id="american-dates"> 747 <h1>American Dates</h1> 796 748 <dl class="docutils"> 797 749 <dt>americanDate(str):</dt> 798 <dd> Convert an MM/DD/YYYY dateto a Date object</dd>750 <dd>MM/DD/YYYY to a Date object</dd> 799 751 <dt>toAmericanDate(date):</dt> 800 <dd> Convert a Date object to a M/D/YYYY date (1/1/2001)</dd>752 <dd>Date object to M/D/YYYY</dd> 801 753 <dt>toPaddedAmericanDate(date):</dt> 802 <dd> Convert a Date object to a MM/DM/YYYY date (01/01/2001)</dd>754 <dd>Date object to MM/DM/YYYY</dd> 803 755 </dl> 804 756 </div> … … 807 759 <dl class="docutils"> 808 760 <dt>isoTimestamp(str):</dt> 809 <dd>Convert a YYYY-MM-DD hh:mm:ss or YYYY-MM-DDThh:mm:ssZ timestamp to a 810 Date object</dd> 761 <dd>YYYY-MM-DDThh:mm:ssZ to Date object</dd> 811 762 <dt>toISOTime(date):</dt> 812 <dd> Convert a Date object to a hh:mm:ss string</dd>763 <dd>Date object to hh:mm:ss</dd> 813 764 <dt>toISOTimestamp(date, realISO=false):</dt> 814 <dd>Convert a Date object to a YYYY-MM-DD hh:mm:ss string. If realISO is true, 815 then use the proper YYYY-MM-DDThh:mm:ssZ form.</dd> 765 <dd>Date object to a YYYY-MM-DD hh:mm:ss (or YYYY-MM-DDThh:mm:ssZ)</dd> 816 766 </dl> 817 767 </div> … … 819 769 <h1>MochiKit.Format</h1> 820 770 <ul class="simple"> 821 <li>JavaScript doesn't really do string formatting</li>822 <li> Users like to see big numbers with thousands separators</li>823 <li> Number formatting based on Java's Number Format Pattern Syntax</li>824 </ul> 825 </div> 826 <div class="slide" id=" simple-string-mangling">827 <h1> Simple String Mangling</h1>771 <li>JavaScript has no sprintf</li> 772 <li>Thousands separators help readability</li> 773 <li>Based on Java's Number Format Pattern Syntax</li> 774 </ul> 775 </div> 776 <div class="slide" id="whitespace-assassins"> 777 <h1>Whitespace Assassins</h1> 828 778 <dl class="docutils"> 829 779 <dt>strip(str, chars="\s"):</dt> 830 <dd>Return a string based on str with leading and trailing whitespace stripped. 831 If the chars regex is specified, it will be used instead of the default.</dd> 780 <dd>strip leading and trailing whitespace</dd> 832 781 <dt>lstrip(str, chars="\s"):</dt> 833 782 <dd>strip only leading whitespace</dd> … … 839 788 <h1>Number Formatting</h1> 840 789 <dl class="docutils"> 841 <dt>numberFormatter(pattern , placeholder="", locale="default"):</dt>842 <dd> Return a function that formats numbers using the givenpattern</dd>843 </dl> 844 </div> 845 <div class="slide" id=" number-formatter-examples">846 <h1> Number Formatter Examples</h1>790 <dt>numberFormatter(pattern):</dt> 791 <dd>new function that formats numbers to pattern</dd> 792 </dl> 793 </div> 794 <div class="slide" id="currency-formatter-example"> 795 <h1>Currency Formatter Example</h1> 847 796 <p>Currency:</p> 848 797 <pre class="literal-block"> … … 851 800 "$1,234,567.89" 852 801 </pre> 853 <p>Percents:</p> 802 </div> 803 <div class="slide" id="percent-formatter-example"> 804 <h1>Percent Formatter Example</h1> 805 <p>Percent:</p> 854 806 <pre class="literal-block"> 855 807 >>> percentFormat = numberFormatter("###,###%") … … 863 815 <li>alert() sucks</li> 864 816 <li>Debugging is hard enough</li> 865 <li> Not every browser has FireBug</li>866 <li> I've had no luck with Venkman</li>867 <li> Less luck with Microsoft's Script Debugger</li>817 <li>FireBug not portable</li> 818 <li>Venkman hard to use</li> 819 <li>Microsoft Script Debugger....</li> 868 820 </ul> 869 821 </div> 870 822 <div class="slide" id="simple-logging"> 871 <h1>Simple logging</h1>823 <h1>Simple Logging</h1> 872 824 <dl class="docutils"> 873 825 <dt>log(msg):</dt> 874 826 <dd>Logs a message at the INFO level</dd> 875 <dt>logDebug(msg):</dt> 876 <dd>Logs a message at the DEBUG level</dd> 877 </dl> 878 <p>logWarning, logError, logFatal...</p> 879 </div> 880 <div class="slide" id="where-d-my-log-messages-go"> 881 <h1>Where'd my log messages go?</h1> 882 <ul class="simple"> 883 <li>In Safari, Firefox with FireBug, and Opera they will be logged to the 884 appropriate console (but you can turn this off).</li> 885 <li>Will also go to any logging listener</li> 886 <li>Logging listeners are just functions that take log message objects</li> 887 </ul> 827 </dl> 828 <p>logDebug, logWarning, logError, logFatal...</p> 829 </div> 830 <div class="slide" id="logs-are-where"> 831 <h1>Logs Are Where?</h1> 832 <dl class="docutils"> 833 <dt>Native console:</dt> 834 <dd>Safari, FireBug, Opera</dd> 835 <dt>Logging listener(s):</dt> 836 <dd>functions called with log message objects</dd> 837 </dl> 888 838 </div> 889 839 <div class="slide" id="bookmarklet-debugging"> 890 840 <h1>Bookmarklet Debugging</h1> 891 <p> Just bookmark this:</p>841 <p>Pop-up MochiKit.LoggingPane:</p> 892 842 <pre class="literal-block"> 893 843 javascript:MochiKit.Logging.logger.debuggingBookmarklet() 894 844 </pre> 895 <p>Currently, this is a pop-up MochiKit.LoggingPane.</p>896 845 </div> 897 846 <div class="slide" id="mochikit-loggingpane"> 898 847 <h1>MochiKit.LoggingPane</h1> 899 848 <ul class="simple"> 900 <li> A usableMochiKit.Logging listener</li>849 <li>MochiKit.Logging listener</li> 901 850 <li>Can be used in-line or as a pop-up window</li> 902 <li>Could be fancier, but it gets the job done</li>903 851 </ul> 904 852 </div> … … 921 869 <h1>MochiKit.DOM</h1> 922 870 <ul class="simple"> 923 <li> DOM is painful, but it doesn't have to be</li>924 <li> Functions for finding, creating, modifyingDOM nodes</li>925 <li> Most functions will take either a string or a DOM node reference, saving926 you the trouble of getElementById(s), $(s) or similar.</li>871 <li>W3C bindings are painful</li> 872 <li>Easily find, create, mangle DOM nodes</li> 873 <li>Don't need $(s), automatic</li> 874 <li>Works on responseXML too!</li> 927 875 </ul> 928 876 </div> … … 930 878 <h1>createDOM</h1> 931 879 <ul class="simple"> 932 <li> Does a good job of turning any object into a DOM node</li>933 <li>Strings and numbers to text, flattens Arrays or iterators of anything</li>934 <li>Extensible with an adapter registry</li>880 <li>Any object into a DOM node</li> 881 <li>Strings to text, flattens iterators</li> 882 <li>Extensible</li> 935 883 </ul> 936 884 </div> 937 885 <div class="slide" id="createdom-example"> 938 <h1>createDOM example</h1>886 <h1>createDOM Example</h1> 939 887 <p>createDOM(tagName, attributes, contents...)</p> 940 888 <p>A simple list:</p> … … 944 892 createDOM("li", null, "second")); 945 893 </pre> 946 <p> Equivalent to:</p>894 <p>Renders as:</p> 947 895 <pre class="literal-block"> 948 896 <ul><li>first</li><li>second</li></ul> 949 897 </pre> 950 898 </div> 951 <div class="slide" id=" but-that-s-still-ugly">952 <h1> But that's still ugly...</h1>953 <p> We use aliases instead, for all of thecommon tags:</p>899 <div class="slide" id="less-ugly"> 900 <h1>Less Ugly</h1> 901 <p>Use aliases instead, supports common tags:</p> 954 902 <pre class="literal-block"> 955 903 var node = UL(null, … … 957 905 LI("second")); 958 906 </pre> 959 <p>Note that MochiKit 1.3 and later allows a text node as the first 960 parameter for convenience (saves a lot of "null" typing)</p> 961 </div> 962 <div class="slide" id="flattening-lists"> 963 <h1>Flattening lists</h1> 964 <p>Functional programming comes in handy for DOM creation:</p> 907 </div> 908 <div class="slide" id="flattening-for-the-dom"> 909 <h1>Flattening for the DOM</h1> 910 <p>Functional style handy for DOM creation:</p> 965 911 <pre class="literal-block"> 966 912 var items = ["first", "second"]; … … 968 914 </pre> 969 915 </div> 970 <div class="slide" id=" what-about-attributes">971 <h1> What about attributes?</h1>916 <div class="slide" id="attributes"> 917 <h1>Attributes</h1> 972 918 <p>First parameter is either an object (attributes), or a string (text node):</p> 973 919 <pre class="literal-block"> … … 980 926 </pre> 981 927 </div> 982 <div class="slide" id="alternating -classes">983 <h1>Alternating classes</h1>984 <p>Mo re MochiKit.Iter goodies,good for table rows:</p>928 <div class="slide" id="alternating"> 929 <h1>Alternating</h1> 930 <p>MochiKit.Iter good for table rows:</p> 985 931 <pre class="literal-block"> 986 932 var classes = cycle( … … 1009 955 </div> 1010 956 <div class="slide" id="scraping-text"> 1011 <h1>Scraping text</h1>957 <h1>Scraping Text</h1> 1012 958 <p>Scraping text is useful for progressive enhancement...</p> 1013 959 <p>HTML:</p> … … 1021 967 </pre> 1022 968 </div> 1023 <div class="slide" id=" reading-forms">1024 <h1> Reading forms</h1>969 <div class="slide" id="forms"> 970 <h1>Forms</h1> 1025 971 <p>HTML:</p> 1026 972 <pre class="literal-block"> … … 1036 982 </pre> 1037 983 </div> 1038 <div class="slide" id="manipulating-dom -nodes">1039 <h1>Manipulating DOM nodes</h1>984 <div class="slide" id="manipulating-dom"> 985 <h1>Manipulating DOM</h1> 1040 986 <dl class="docutils"> 1041 987 <dt>appendChildNodes(parentNode, childNode...):</dt> 1042 <dd>Add nodes to parentNode using the DOM coercion rules fromcreateDOM</dd>988 <dd>Add nodes via createDOM</dd> 1043 989 <dt>replaceChildNodes(parentNode, childNode...):</dt> 1044 <dd>Remove all children from parentNode, then appendChildNodes</dd>990 <dd>Remove all, then append</dd> 1045 991 <dt>swapDOM(dest, src):</dt> 1046 <dd>Replace dest with src ( if src is null, then dest is removed)</dd>1047 </dl> 1048 </div> 1049 <div class="slide" id=" manipulating-dom-attributes">1050 <h1> Manipulating DOM attributes</h1>992 <dd>Replace dest with src (or remove)</dd> 993 </dl> 994 </div> 995 <div class="slide" id="dom-attributes"> 996 <h1>DOM Attributes</h1> 1051 997 <dl class="docutils"> 1052 998 <dt>setNodeAttribute(node, attr, value):</dt> 1053 <dd> Set thenode attribute attr=value</dd>999 <dd>node attribute attr=value</dd> 1054 1000 <dt>updateNodeAttributes(node, attrs):</dt> 1055 <dd>Set the node attributes based on theobject attrs</dd>1001 <dd>Set the node attributes from object attrs</dd> 1056 1002 </dl> 1057 1003 </div> … … 1072 1018 </ul> 1073 1019 </div> 1074 <div class="slide" id="c reating-colors-from-components">1075 <h1>C reating colors from components</h1>1020 <div class="slide" id="components-to-color"> 1021 <h1>Components to Color</h1> 1076 1022 <ul class="simple"> 1077 1023 <li>Color.fromRGB(r, g, b, alpha=1.0)</li> 1078 <li>Color.fromHSL(h, s, l, alpha=1.0)</li> 1079 <li>Color.fromHSV(h, s, v, alpha=1.0)</li> 1080 </ul> 1081 <p>Will also take objects, e.g. {r: 1, g: 0, b: 0, a: 1}</p> 1082 </div> 1083 <div class="slide" id="creating-colors-from-strings"> 1084 <h1>Creating colors from strings</h1> 1024 <li>fromHSL, fromHSV</li> 1025 <li>Will also take objects, e.g. {r: 1, g: 0, b: 0, a: 1}</li> 1026 </ul> 1027 </div> 1028 <div class="slide" id="string-to-color"> 1029 <h1>String to Color</h1> 1085 1030 <dl class="docutils"> 1086 1031 <dt>Color.fromString(str):</dt> 1087 <dd>Generally "does what you mean" with any valid CSS color description. 1088 "rgb(...)", "hsl(...)", "#RRGGBB", "blue"</dd> 1032 <dd>Any valid CSS color description. "rgb(...)", "hsl(...)", "#RRGGBB", "blue"</dd> 1089 1033 </dl> 1090 1034 <p>Implementations in fromRGBString, fromHSLString, fromHexString, fromName.</p> 1091 1035 </div> 1092 <div class="slide" id=" creating-colors-from-dom-elements">1093 <h1> Creating colors from DOM elements</h1>1036 <div class="slide" id="dom-to-color"> 1037 <h1>DOM to Color</h1> 1094 1038 <ul class="simple"> 1095 1039 <li>Color.fromBackground(node)</li> … … 1098 1042 </ul> 1099 1043 </div> 1100 <div class="slide" id=" built-in-nscolor-colors">1101 <h1> Built-inNSColor colors</h1>1102 <p> NSColor-based constructors for basic colors</p>1044 <div class="slide" id="nscolor-colors"> 1045 <h1>NSColor colors</h1> 1046 <p>Cocoa-based constructors for basic colors</p> 1103 1047 <ul class="simple"> 1104 1048 <li>Color.whiteColor()</li> 1105 <li>Color.blueColor()</li> 1106 <li>Color.transparentColor()</li> 1107 <li>...</li> 1049 <li>blueColor, transparentColor, ...</li> 1108 1050 </ul> 1109 1051 </div> … … 1112 1054 <ul class="simple"> 1113 1055 <li>color.blendedColor(otherColor, fraction)</li> 1114 <li>color.colorWithHue(hue)</li> 1115 <li>color.colorWithLevel(level)</li> 1116 <li>color.colorWithSaturation(saturation)</li> 1117 <li>color.colorWithAlpha(alpha)</li> 1118 </ul> 1119 </div> 1120 <div class="slide" id="getting-color-values"> 1121 <h1>Getting color values</h1> 1056 <li>color.colorWithHue, colorWithLevel, ...</li> 1057 </ul> 1058 </div> 1059 <div class="slide" id="color-components"> 1060 <h1>Color Components</h1> 1122 1061 <p>Objects:</p> 1123 1062 <ul class="simple"> 1124 <li>color.asRGB()</li> 1125 <li>color.asHSL()</li> 1126 <li>color.asHSV()</li> 1063 <li>color.asRGB(), asHSL, asHSV</li> 1127 1064 </ul> 1128 1065 <p>Strings:</p> 1129 1066 <ul class="simple"> 1130 <li>color.toHexString()</li> 1131 <li>color.toRGBString()</li> 1132 <li>color.toHSLString()</li> 1067 <li>color.toHexString(), toRGBString, toHSLString</li> 1133 1068 </ul> 1134 1069 </div> … … 1136 1071 <h1>MochiKit.Async</h1> 1137 1072 <ul class="simple"> 1138 <li> Yes, there is AJAX</li>1139 <li> Generalized asynchronous model based on Twisted</li>1140 <li> HandlesXMLHttpRequest and timed events (setTimeout)</li>1073 <li>AJAX!</li> 1074 <li>Model based on Twisted</li> 1075 <li>XMLHttpRequest and timed events (setTimeout)</li> 1141 1076 </ul> 1142 1077 </div> … … 1144 1079 <h1>WTF is a Deferred?</h1> 1145 1080 <ul class="simple"> 1146 <li>A "promise" to call back exactly once with a single result (or error) 1147 at some time (could be immediately!)</li> 1081 <li>A "promise" for a result</li> 1148 1082 <li>Can be chained</li> 1149 <li>Model works in any asynchronous platform with nearly any language</li> 1150 <li>Not "ideal" API, but without threads or anything resembling coroutines 1151 it's the best you can do.</li> 1083 <li>Model on any asynchronous platform</li> 1084 <li>Not "ideal" API, but no coroutines or threads</li> 1152 1085 </ul> 1153 1086 </div> … … 1156 1089 <dl class="docutils"> 1157 1090 <dt>succeed(value):</dt> 1158 <dd> A successful deferred that will callback withvalue</dd>1091 <dd>successful Deferred from value</dd> 1159 1092 <dt>fail(error):</dt> 1160 <dd> A failed deferred that will errback with value</dd>1093 <dd>failed Deferred from error</dd> 1161 1094 <dt>maybeDeferred(func, arguments..):</dt> 1162 <dd>Call a function and make sure it returns a Deferred. Non-deferred return 1163 values get wrapped with succeed, and errors get wrapped with fail.</dd> 1095 <dd>Deferred from func(args..) call</dd> 1164 1096 </dl> 1165 1097 </div> … … 1168 1100 <dl class="docutils"> 1169 1101 <dt>wait(seconds, value):</dt> 1170 <dd> Return a Deferred that calls back with value after seconds have passed</dd>1102 <dd>Deferred that waits</dd> 1171 1103 <dt>callLater(seconds, func, arguments...):</dt> 1172 <dd> Return a Deferred that will call func(arguments) after seconds have passed</dd>1104 <dd>Deferred that waits, then calls</dd> 1173 1105 </dl> 1174 1106 </div> … … 1177 1109 <dl class="docutils"> 1178 1110 <dt>doSimpleXMLHttpRequest(url[, queryArguments]):</dt> 1179 <dd>Set up a GET XMLHttpRequest to url and return a Deferred. The Deferred 1180 will callback with the XMLHttpRequest instance.</dd> 1111 <dd>Deferred from XMLHttpRequest GET</dd> 1181 1112 <dt>loadJSONDoc(url[, queryArguments]):</dt> 1182 <dd>Set up a simple XMLHttpRequest, process its responseText as JSON, and 1183 callback with the JSON object.</dd> 1113 <dd>Deferred from XMLHttpRequest GET then eval</dd> 1114 <dt>sendXMLHttpRequest(req, content):</dt> 1115 <dd>Deferred from async XMLHttpRequest</dd> 1184 1116 </dl> 1185 1117 </div> … … 1198 1130 <div class="slide" id="result-chaining"> 1199 1131 <h1>Result Chaining</h1> 1200 <p> The implementation of loadJSONDoc looks like this:</p>1132 <p>loadJSONDoc implementation:</p> 1201 1133 <pre class="literal-block"> 1202 1134 var d = doSimpleXMLHttpRequest(url); … … 1204 1136 return d; 1205 1137 </pre> 1206 <p>Further callbacks get the result of evalJSONDoc, not the original 1207 doSimpleXMLHttpRequest result.</p> 1138 <p>Uses Deferred's chained results</p> 1208 1139 </div> 1209 1140 <div class="slide" id="deferred-chaining"> … … 1211 1142 <p>Returning a Deferred from a callback will "pause" the callback chain:</p> 1212 1143<
