Changeset 741
- Timestamp:
- 04/24/06 22:12:32 (2 years ago)
- Files:
-
- presentations/2006/ajax_experience/includes (added)
- presentations/2006/ajax_experience/includes/interpreter.html (added)
- presentations/2006/ajax_experience/includes/logging_pane.html (added)
- presentations/2006/ajax_experience/includes/logo.html (added)
- presentations/2006/ajax_experience/slides.txt (modified) (10 diffs)
- presentations/2006/ajax_experience/ui/mochikit/examples/interpreter.css (modified) (2 diffs)
- presentations/2006/ajax_experience/ui/mochikit/examples/interpreter.js (modified) (1 diff)
- presentations/2006/ajax_experience/ui/mochikit/mochikit.css (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
presentations/2006/ajax_experience/slides.txt
r739 r741 99 99 ``__repr__`` 100 100 101 * Extensible with an adapter registry102 103 101 104 102 MochiKit Interpreter … … 114 112 * JavaScript comparisons are WHACK (these are ``true``!) 115 113 114 116 115 - [1,"2"] == "1,2" 117 116 - ([""] == "") && ([] == "") && ([] != [""]) 118 117 119 118 119 120 120 * compare(a, b) provides consistent results 121 121 122 122 123 - Usable with Array.prototype.sort … … 142 143 * Adapters let you extend existing functions 143 144 144 - registerRepr (name, check, wrap, override=false)145 - registerComparator (name, check, wrap, override=false)146 - registerJSON (name, check, wrap, override=false)145 - registerRepr 146 - registerComparator 147 - registerJSON 147 148 148 149 … … 173 174 } 174 175 175 registerComparator("compareDOM", isDOMNode, compareDOMNode); 176 registerComparator("compareDOM", 177 isDOMNode, compareDOMNode); 176 178 177 179 … … 336 338 337 339 cycle(iterable): 338 Iterates over iterable and saves the results. Once iterable is exhausted,340 Iterates over iterable and saves the results. Once iterable is exhausted, 339 341 it iterates over the cached result Array indefinitely. 340 342 … … 395 397 396 398 toISOTimestamp(date, realISO=false): 397 Convert a Date object to a YYYY-MM-DD hh:mm:ss string. If realISO is true,399 Convert a Date object to a YYYY-MM-DD hh:mm:ss string. If realISO is true, 398 400 then use the proper YYYY-MM-DDThh:mm:ssZ form. 399 401 … … 427 429 Return a function that formats numbers using the given pattern 428 430 429 Examples:: 431 Number Formatter Examples 432 ========================= 430 433 434 Currency:: 435 431 436 >>> dollarFormat = numberFormatter("$###,###.##") 432 437 >>> dollarFormat(1234567.89) 433 438 "$1,234,567.89" 434 439 440 441 Percents:: 442 435 443 >>> percentFormat = numberFormatter("###,###%") 436 444 >>> percentFormat(123.45) … … 497 505 498 506 createLoggingPane(true) 507 508 509 Inline LoggingPane Example 510 ========================== 511 512 .. raw:: html 513 :file: includes/logging_pane.html 499 514 500 515 … … 739 754 740 755 maybeDeferred(func, arguments..): 741 Call a function and make sure it returns a Deferred. Non-deferred return756 Call a function and make sure it returns a Deferred. Non-deferred return 742 757 values get wrapped with succeed, and errors get wrapped with fail. 743 758 … … 757 772 758 773 doSimpleXMLHttpRequest(url[, queryArguments]): 759 Set up a GET XMLHttpRequest to url and return a Deferred. The Deferred774 Set up a GET XMLHttpRequest to url and return a Deferred. The Deferred 760 775 will callback with the XMLHttpRequest instance. 761 776 presentations/2006/ajax_experience/ui/mochikit/examples/interpreter.css
r739 r741 5 5 padding: 2px 4px; 6 6 margin-top: .3em; 7 width: 96%; 7 8 } 8 9 … … 16 17 padding: 2px 4px; 17 18 margin-top: .3em; 18 width: 600px;19 height: 300px;19 width: 95%; 20 height: 11em; 20 21 overflow: auto; 21 22 } presentations/2006/ajax_experience/ui/mochikit/examples/interpreter.js
r739 r741 261 261 }; 262 262 263 window.writeln = function () { 264 appendChildNodes("interpreter_output", 265 SPAN({"class": "data"}, arguments), 266 BR() 267 ); 268 interpreterManager.doScroll(); 269 }; 270 271 window.clear = function () { 272 replaceChildNodes("interpreter_output"); 273 getElement("interpreter_area").scrollTop = 0; 274 }; 275 276 window.blockOn = function (d) { 277 if (!(d instanceof Deferred)) { 278 throw new TypeError(repr(d) + " is not a Deferred!"); 279 } 280 interpreterManager.blockOn(d); 281 }; 282 283 window.dir = function (o) { 284 // Python muscle memory! 285 return sorted(keys(o)); 286 }; 287 288 window.inspect = function (o) { 289 window._ = o; 290 if ((typeof(o) != "function" && typeof(o) != "object") || o == null) { 291 window.writeln(repr(o)); 292 return; 293 } 294 var pairs = items(o); 295 if (pairs.length == 0) { 296 window.writeln(repr(o)); 297 return; 298 } 299 window.writeln(TABLE({"border": "1"}, 300 THEAD({"class": "invisible"}, TR(null, TD(), TD())), 301 TFOOT({"class": "invisible"}, TR(null, TD(), TD())), 302 TBODY(null, 303 map( 304 function (kv) { 305 var click = function () { 306 try { 307 window.inspect(kv[1]); 308 } catch (e) { 309 interpreterManager.showError(e); 263 InterpreterManager.prototype.setupWindowFunctions = function () { 264 window.writeln = function () { 265 appendChildNodes("interpreter_output", 266 SPAN({"class": "data"}, arguments), 267 BR() 268 ); 269 interpreterManager.doScroll(); 270 }; 271 272 window.clear = function () { 273 replaceChildNodes("interpreter_output"); 274 getElement("interpreter_area").scrollTop = 0; 275 }; 276 277 window.blockOn = function (d) { 278 if (!(d instanceof Deferred)) { 279 throw new TypeError(repr(d) + " is not a Deferred!"); 280 } 281 interpreterManager.blockOn(d); 282 }; 283 284 window.dir = function (o) { 285 // Python muscle memory! 286 return sorted(keys(o)); 287 }; 288 289 window.inspect = function (o) { 290 window._ = o; 291 if ((typeof(o) != "function" && typeof(o) != "object") || o == null) { 292 window.writeln(repr(o)); 293 return; 294 } 295 var pairs = items(o); 296 if (pairs.length == 0) { 297 window.writeln(repr(o)); 298 return; 299 } 300 window.writeln(TABLE({"border": "1"}, 301 THEAD({"class": "invisible"}, TR(null, TD(), TD())), 302 TFOOT({"class": "invisible"}, TR(null, TD(), TD())), 303 TBODY(null, 304 map( 305 function (kv) { 306 var click = function () { 307 try { 308 window.inspect(kv[1]); 309 } catch (e) { 310 interpreterManager.showError(e); 311 } 312 return false; 310 313 } 311 return false; 312 } 313 return TR(null, 314 TD(null, A({href: "#", onclick: click}, kv[0])), 315 TD(null, repr(kv[1])) 316 ); 317 }, 318 pairs 314 return TR(null, 315 TD(null, A({href: "#", onclick: click}, kv[0])), 316 TD(null, repr(kv[1])) 317 ); 318 }, 319 pairs 320 ) 319 321 ) 320 ) 321 ));322 )); 323 }; 322 324 }; 323 325 presentations/2006/ajax_experience/ui/mochikit/mochikit.css
r739 r741 2 2 div#mochikit_logo { 3 3 background: transparent url(mochikit_logo.gif) 0 0 no-repeat; 4 z-index: 10000;5 4 position: absolute; 6 5 right: 0px; … … 9 8 height: 85px; 10 9 } 10 11 div#header { 12 background: transparent; 13 border-bottom: 1px solid black; 14 } 15 16 div#footer { 17 background: transparent; 18 border-top: 1px solid black; 19 } 20 21 body { 22 color: rgb(92, 93, 95); 23 font-family: Verdana,Helvetica,sans-serif; 24 } 25 26 .slide h1, #slide0 h1, #footer h1 { 27 background-color: transparent; 28 color: rgb(75, 129, 188); 29 font-family: Trebuchet MS,verdana,sans-serif; 30 }
