old_sql 1.16.0 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +24 -13
- data/app/controllers/old_sql/report_controller.rb +3 -17
- data/app/views/layouts/old_sql/chart.html.erb +11 -0
- data/app/views/old_sql/report/chart.html.erb +8 -25
- data/lib/generators/old_sql/templates/user_design_template.csv +2 -3
- data/lib/generators/old_sql/templates/user_old_sql_demo_chart_design.yml +18 -9
- data/lib/old_sql/report_design/chart.rb +2 -2
- data/lib/old_sql/report_design/chart_item.rb +4 -4
- data/lib/old_sql/report_design/chart_parser.rb +2 -2
- data/public/javascripts/old_sql/chart.js +33 -0
- metadata +5 -265
- data/public/javascripts/old_sql/MochiKit-1.4.2/Changes +0 -362
- data/public/javascripts/old_sql/MochiKit-1.4.2/LICENSE.txt +0 -69
- data/public/javascripts/old_sql/MochiKit-1.4.2/MANIFEST +0 -179
- data/public/javascripts/old_sql/MochiKit-1.4.2/META.json +0 -17
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Async.html +0 -814
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Base.html +0 -1703
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Color.html +0 -755
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/DOM.html +0 -1197
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/DateTime.html +0 -168
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/DragAndDrop.html +0 -187
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Format.html +0 -300
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Iter.html +0 -524
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Logging.html +0 -420
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/LoggingPane.html +0 -142
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Position.html +0 -38
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Selector.html +0 -240
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Signal.html +0 -508
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Sortable.html +0 -244
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Style.html +0 -385
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/VersionHistory.html +0 -384
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Visual.html +0 -1161
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/index.html +0 -447
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/js/toc.js +0 -113
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Async.rst +0 -767
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Base.rst +0 -1445
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Color.rst +0 -651
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/DOM.rst +0 -1143
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/DateTime.rst +0 -145
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/DragAndDrop.rst +0 -197
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Format.rst +0 -258
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Iter.rst +0 -454
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Logging.rst +0 -348
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/LoggingPane.rst +0 -128
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Position.rst +0 -26
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Selector.rst +0 -203
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Signal.rst +0 -498
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Sortable.rst +0 -186
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Style.rst +0 -353
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/VersionHistory.rst +0 -362
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Visual.rst +0 -895
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/index.rst +0 -83
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/ajax_tables/ajax_tables.css +0 -69
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/ajax_tables/ajax_tables.js +0 -401
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/ajax_tables/domains.json +0 -10
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/ajax_tables/domains.xml +0 -40
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/ajax_tables/index.html +0 -96
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/color_wheel/color_wheel.css +0 -4
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/color_wheel/color_wheel.js +0 -95
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/color_wheel/index.html +0 -31
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/dnd_sortable.css +0 -23
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/dropmarker.png +0 -0
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/icon.png +0 -0
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/index.html +0 -54
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/sortable2_test.html +0 -150
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/sortable3_test.html +0 -42
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/sortable4_test.html +0 -90
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/sortable5_test.html +0 -29
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/sortable_test.html +0 -38
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/sortable_tree_test.html +0 -189
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/draggable/draggable.css +0 -28
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/draggable/draggable.js +0 -73
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/draggable/index.html +0 -38
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_bigslide.html +0 -36
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_blind.html +0 -65
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_blindslide.html +0 -31
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_combi.css +0 -18
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_fadeappear.html +0 -61
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_grow_shrink.html +0 -38
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_onload.html +0 -67
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_queue.html +0 -67
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_queue_limit.html +0 -30
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_scroll.html +0 -483
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_slide.html +0 -62
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/full.html +0 -71
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/icon.png +0 -0
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/index.html +0 -150
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/interpreter/index.html +0 -88
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/interpreter/interpreter.css +0 -54
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/interpreter/interpreter.js +0 -373
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/key_events/index.html +0 -78
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/key_events/key_events.css +0 -5
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/key_events/key_events.js +0 -85
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/logging_pane/index.html +0 -46
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/logging_pane/logging_pane.css +0 -78
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/logging_pane/logging_pane.js +0 -11
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/mochiregexp/index.html +0 -74
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/mochiregexp/mochiregexp.css +0 -73
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/mochiregexp/mochiregexp.js +0 -125
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/mouse_events/index.html +0 -88
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/mouse_events/mouse_events.css +0 -17
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/mouse_events/mouse_events.js +0 -59
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/rounded_corners/index.html +0 -28
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/rounded_corners/rounded_corners.css +0 -3
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/rounded_corners/rounded_corners.js +0 -19
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/dnd_boxes.html +0 -45
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/dnd_full.html +0 -119
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/dnd_ghost.html +0 -40
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/dnd_hoverclass.html +0 -43
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/dnd_scroll.html +0 -91
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/dnd_snap.html +0 -54
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/index.html +0 -93
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/simple_dnd.css +0 -64
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/sortable_tables/index.html +0 -71
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/sortable_tables/sortable_tables.css +0 -66
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/sortable_tables/sortable_tables.js +0 -203
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/SyntaxHighlighter.css +0 -177
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/Tests.html +0 -339
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushCSharp.js +0 -30
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushDelphi.js +0 -31
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushJScript.js +0 -22
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushPhp.js +0 -23
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushPython.js +0 -71
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushSql.js +0 -40
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushVb.js +0 -29
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushXml.js +0 -61
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shCore.js +0 -622
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/view-source.css +0 -1
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/view-source.html +0 -19
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/view-source.js +0 -70
- data/public/javascripts/old_sql/MochiKit-1.4.2/include/_img/bg_docheader.gif +0 -0
- data/public/javascripts/old_sql/MochiKit-1.4.2/include/_img/g_bullet.gif +0 -0
- data/public/javascripts/old_sql/MochiKit-1.4.2/include/_img/g_logo_doc.gif +0 -0
- data/public/javascripts/old_sql/MochiKit-1.4.2/include/css/documentation.css +0 -130
- data/public/javascripts/old_sql/MochiKit-1.4.2/include/css/general.css +0 -48
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Async.js +0 -682
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Base.js +0 -1489
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Color.js +0 -863
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/DOM.js +0 -1256
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/DateTime.js +0 -222
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/DragAndDrop.js +0 -793
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Format.js +0 -304
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Iter.js +0 -844
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Logging.js +0 -315
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/LoggingPane.js +0 -353
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/MochiKit.js +0 -188
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/MockDOM.js +0 -115
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Position.js +0 -236
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Selector.js +0 -415
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Signal.js +0 -897
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Sortable.js +0 -589
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Style.js +0 -594
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Test.js +0 -162
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Visual.js +0 -2026
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/__package__.js +0 -18
- data/public/javascripts/old_sql/MochiKit-1.4.2/packed/MochiKit/MochiKit.js +0 -7829
- data/public/javascripts/old_sql/MochiKit-1.4.2/packed/MochiKit/__package__.js +0 -6
- data/public/javascripts/old_sql/MochiKit-1.4.2/packed/MochiKit/customize.html +0 -251
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/FakeJSAN.js +0 -40
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/SimpleTest/SimpleTest.js +0 -381
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/SimpleTest/TestRunner.js +0 -159
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/SimpleTest/test.css +0 -28
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/cli.js +0 -6
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/index.html +0 -25
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/standalone.js +0 -16
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_Base.js +0 -577
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_Color.js +0 -137
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_DateTime.js +0 -52
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_DragAndDrop.js +0 -30
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_Format.js +0 -89
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_Iter.js +0 -186
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_Logging.js +0 -88
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Async.html +0 -408
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Async.json +0 -1
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Base.html +0 -34
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Color.html +0 -84
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-DOM-Safari.html +0 -48
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-DOM.html +0 -363
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-DateTime.html +0 -39
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-DragAndDrop.html +0 -54
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Format.html +0 -39
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Iter.html +0 -38
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-JSAN.html +0 -32
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Logging.html +0 -40
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-MochiKit.html +0 -18
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Selector.html +0 -295
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Signal.html +0 -43
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Style.html +0 -223
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Visual.html +0 -197
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_Signal.js +0 -481
- data/public/javascripts/old_sql/plotkit-0.9.1/COPYING +0 -28
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/Base.js +0 -406
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/Canvas.js +0 -683
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/EasyPlot.js +0 -161
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/Layout.js +0 -756
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/PlotKit.js +0 -151
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/PlotKit_Packed.js +0 -2177
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/SVG.js +0 -705
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/SweetCanvas.js +0 -348
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/SweetSVG.js +0 -247
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/dummy.svg +0 -9
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/excanvas.js +0 -723
- data/public/javascripts/old_sql/plotkit-0.9.1/README +0 -1
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/MochiKitAdditions.html +0 -2
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/MochiKitAdditions.txt +0 -2
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Base.html +0 -302
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Base.txt +0 -139
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Canvas.html +0 -172
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Canvas.txt +0 -81
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.EasyPlot.html +0 -155
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.EasyPlot.txt +0 -50
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Layout.html +0 -428
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Layout.txt +0 -330
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.QuickStart.html +0 -368
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.QuickStart.txt +0 -256
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Renderer.html +0 -436
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Renderer.txt +0 -299
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.SVG.html +0 -159
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.SVG.txt +0 -64
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.SweetCanvas.html +0 -131
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.SweetCanvas.txt +0 -34
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.SweetSVG.html +0 -131
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.SweetSVG.txt +0 -34
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.html +0 -334
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.txt +0 -151
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/SVGCanvasCompat.html +0 -304
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/SVGCanvasCompat.txt +0 -144
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/barsample.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/black.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/blue.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/cyan.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/doc.css +0 -62
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/generate.py +0 -37
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/green.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/orange.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/piesample.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/purple.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/red.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/scripts/custom_rhino.jar +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/scripts/pack.py +0 -58
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/axis.html +0 -31
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/basic.html +0 -25
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/basic.js +0 -143
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/debug.html +0 -56
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/demo-svg.html +0 -58
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/demo-svg.js +0 -133
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/demo.html +0 -57
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/demo.js +0 -136
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/dynamic.html +0 -161
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/img/firefox.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/img/konqueror.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/img/mozilla.ico +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/img/msie.gif +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/img/opera.ico +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/img/safari.gif +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/labels-img.html +0 -38
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/labels.html +0 -43
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/prototype_compat.html +0 -28
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/quickstart-easy.html +0 -29
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/quickstart-horiz.html +0 -53
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/quickstart-neg.html +0 -29
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/quickstart-svg.html +0 -61
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/quickstart.html +0 -57
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/sample.txt +0 -6
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/svg-sweet.html +0 -29
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/svg-sweet.js +0 -141
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/svg.html +0 -26
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/svg.js +0 -147
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/sweet.html +0 -24
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/sweet.js +0 -89
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/tests.css +0 -66
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/testsvg.html +0 -20
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/testsvg.js +0 -31
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"recommends": {
|
|
3
|
-
"JSAN": "0.10"
|
|
4
|
-
},
|
|
5
|
-
"name": "MochiKit",
|
|
6
|
-
"license": "mit",
|
|
7
|
-
"author": [
|
|
8
|
-
"Bob Ippolito <bob@redivi.com>"
|
|
9
|
-
],
|
|
10
|
-
"abstract": "Python-inspired JavaScript kit",
|
|
11
|
-
"generated_by": "MochiKit's build script",
|
|
12
|
-
"build_requires": {
|
|
13
|
-
"Test.Simple": "0.11"
|
|
14
|
-
},
|
|
15
|
-
"version": "1.4.2",
|
|
16
|
-
"provides": {}
|
|
17
|
-
}
|
|
@@ -1,814 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8" ?>
|
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
-
|
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
5
|
-
<head>
|
|
6
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
7
|
-
<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
|
|
8
|
-
<title>MochiKit.Async - manage asynchronous tasks</title>
|
|
9
|
-
|
|
10
|
-
<link rel="stylesheet" href="../../../include/css/documentation.css" type="text/css" />
|
|
11
|
-
<script type="text/javascript" src="../../../packed/lib/MochiKit/MochiKit.js"></script>
|
|
12
|
-
<script type="text/javascript" src="../../js/toc.js"></script>
|
|
13
|
-
</head>
|
|
14
|
-
<body>
|
|
15
|
-
<a href="http://mochikit.com"><img id="mainlink" src="../../../include/_img/g_logo_doc.gif" alt="MochiKit" /></a>
|
|
16
|
-
<a class='indexlink' href='index.html'>Back to docs index</a>
|
|
17
|
-
<div class="document">
|
|
18
|
-
<div class="section">
|
|
19
|
-
<h1><a id="name" name="name">Name</a></h1>
|
|
20
|
-
<p>MochiKit.Async - manage asynchronous tasks</p>
|
|
21
|
-
</div>
|
|
22
|
-
<div class="section">
|
|
23
|
-
<h1><a id="synopsis" name="synopsis">Synopsis</a></h1>
|
|
24
|
-
<pre class="literal-block">
|
|
25
|
-
var url = "/src/b/bo/bob/MochiKit.Async/META.json";
|
|
26
|
-
/*
|
|
27
|
-
|
|
28
|
-
META.json looks something like this:
|
|
29
|
-
|
|
30
|
-
{"name": "MochiKit", "version": "0.5"}
|
|
31
|
-
|
|
32
|
-
*/
|
|
33
|
-
var d = loadJSONDoc(url);
|
|
34
|
-
var gotMetadata = function (meta) {
|
|
35
|
-
if (MochiKit.Async.VERSION == meta.version) {
|
|
36
|
-
alert("You have the newest MochiKit.Async!");
|
|
37
|
-
} else {
|
|
38
|
-
alert("MochiKit.Async "
|
|
39
|
-
+ meta.version
|
|
40
|
-
+ " is available, upgrade!");
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
var metadataFetchFailed = function (err) {
|
|
44
|
-
alert("The metadata for MochiKit.Async could not be fetched :(");
|
|
45
|
-
};
|
|
46
|
-
d.addCallbacks(gotMetadata, metadataFetchFailed);
|
|
47
|
-
</pre>
|
|
48
|
-
</div>
|
|
49
|
-
<div class="section">
|
|
50
|
-
<h1><a id="description" name="description">Description</a></h1>
|
|
51
|
-
<p>MochiKit.Async provides facilities to manage asynchronous (as in AJAX
|
|
52
|
-
<a class="footnote-reference" href="#id7" id="id1" name="id1">[1]</a>) tasks. The model for asynchronous computation used in this
|
|
53
|
-
module is heavily inspired by Twisted <a class="footnote-reference" href="#id8" id="id2" name="id2">[2]</a>.</p>
|
|
54
|
-
</div>
|
|
55
|
-
<div class="section">
|
|
56
|
-
<h1><a id="dependencies" name="dependencies">Dependencies</a></h1>
|
|
57
|
-
<ul class="simple">
|
|
58
|
-
<li><a class="mochiref reference" href="Base.html">MochiKit.Base</a></li>
|
|
59
|
-
</ul>
|
|
60
|
-
</div>
|
|
61
|
-
<div class="section">
|
|
62
|
-
<h1><a id="security-concerns" name="security-concerns">Security Concerns</a></h1>
|
|
63
|
-
<p>The current implementation of evalJSONRequest does no input validation.
|
|
64
|
-
Invalid JSON can execute arbitrary JavaScript code in the client. This isn't
|
|
65
|
-
normally a concern because of the same-origin policy in web browsers; the
|
|
66
|
-
server is already sending arbitrary code to the client (your program!).</p>
|
|
67
|
-
<p>While this isn't directly relevant to MochiKit, server-side code that produces
|
|
68
|
-
JSON should consider potential cross-site request forgery. Currently known
|
|
69
|
-
exploits require a JSON array to be the outer-most object, and the data to be
|
|
70
|
-
leaked must be known keys in objects contained by that array:</p>
|
|
71
|
-
<pre class="literal-block">
|
|
72
|
-
[{"some_known_key": "this can be leaked"}, "but not this"]
|
|
73
|
-
</pre>
|
|
74
|
-
<p>This exploit does not apply to the most common usage of JSON, sending an
|
|
75
|
-
object:</p>
|
|
76
|
-
<pre class="literal-block">
|
|
77
|
-
{"some_known_key": "this can't be leaked"}
|
|
78
|
-
</pre>
|
|
79
|
-
<p>There are several ways to avoid this, here are a few:</p>
|
|
80
|
-
<ul class="simple">
|
|
81
|
-
<li>Use some non-standard addition to JSON that adds constructs to prevent
|
|
82
|
-
script tag parsing, such as wrapping the data in a comment or an infinite
|
|
83
|
-
loop. MochiKit supports comment-wrapped JSON, but it's up to the server
|
|
84
|
-
to send it that way.</li>
|
|
85
|
-
<li>Require some kind of authentication token in the URL.</li>
|
|
86
|
-
<li>Allow only POST requests to access sensitive JSON.</li>
|
|
87
|
-
<li>Only send JSON objects, not arrays. JSON objects aren't valid JavaScript
|
|
88
|
-
syntax on their own without parentheses.</li>
|
|
89
|
-
</ul>
|
|
90
|
-
</div>
|
|
91
|
-
<div class="section">
|
|
92
|
-
<h1><a id="overview" name="overview">Overview</a></h1>
|
|
93
|
-
<div class="section">
|
|
94
|
-
<h2><a id="deferred" name="deferred">Deferred</a></h2>
|
|
95
|
-
<p>The Deferred constructor encapsulates a single value that is not
|
|
96
|
-
available yet. The most important example of this in the context of a
|
|
97
|
-
web browser would be an <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> to a server. The importance
|
|
98
|
-
of the Deferred is that it allows a consistent API to be exposed for
|
|
99
|
-
all asynchronous computations that occur exactly once.</p>
|
|
100
|
-
<p>The producer of the Deferred is responsible for doing all of the
|
|
101
|
-
complicated work behind the scenes. This often means waiting for a
|
|
102
|
-
timer to fire, or waiting for an event (e.g. <tt class="docutils literal"><span class="pre">onreadystatechange</span></tt> of
|
|
103
|
-
<tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt>). It could also be coordinating several events
|
|
104
|
-
(e.g. <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> with a timeout, or several Deferreds
|
|
105
|
-
(e.g. fetching a set of XML documents that should be processed at the
|
|
106
|
-
same time).</p>
|
|
107
|
-
<p>Since these sorts of tasks do not respond immediately, the producer of
|
|
108
|
-
the Deferred does the following steps before returning to the
|
|
109
|
-
consumer:</p>
|
|
110
|
-
<ol class="arabic simple">
|
|
111
|
-
<li>Create a <tt class="docutils literal"><span class="pre">new</span></tt> <a class="mochiref reference" href="#fn-deferred">Deferred();</a> object and keep a
|
|
112
|
-
reference to it, because it will be needed later when the value is
|
|
113
|
-
ready.</li>
|
|
114
|
-
<li>Setup the conditions to create the value requested (e.g. create a
|
|
115
|
-
new <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt>, set its <tt class="docutils literal"><span class="pre">onreadystatechange</span></tt>).</li>
|
|
116
|
-
<li>Return the <a class="mochiref reference" href="#fn-deferred">Deferred</a> object.</li>
|
|
117
|
-
</ol>
|
|
118
|
-
<p>Since the value is not yet ready, the consumer attaches a function to
|
|
119
|
-
the Deferred that will be called when the value is ready. This is not
|
|
120
|
-
unlike <tt class="docutils literal"><span class="pre">setTimeout</span></tt>, or other similar facilities you may already be
|
|
121
|
-
familiar with. The consumer can also attach an "errback" to the
|
|
122
|
-
<a class="mochiref reference" href="#fn-deferred">Deferred</a>, which is a callback for error handling.</p>
|
|
123
|
-
<p>When the value is ready, the producer simply calls
|
|
124
|
-
<tt class="docutils literal"><span class="pre">myDeferred.callback(theValue)</span></tt>. If an error occurred, it should
|
|
125
|
-
call <tt class="docutils literal"><span class="pre">myDeferred.errback(theValue)</span></tt> instead. As soon as this
|
|
126
|
-
happens, the callback that the consumer attached to the
|
|
127
|
-
<a class="mochiref reference" href="#fn-deferred">Deferred</a> is called with <tt class="docutils literal"><span class="pre">theValue</span></tt> as the only argument.</p>
|
|
128
|
-
<p>There are quite a few additional "advanced" features baked into
|
|
129
|
-
<a class="mochiref reference" href="#fn-deferred">Deferred</a>, such as cancellation and callback chains, so
|
|
130
|
-
take a look at the API reference if you would like to know more!</p>
|
|
131
|
-
</div>
|
|
132
|
-
</div>
|
|
133
|
-
<div class="section">
|
|
134
|
-
<h1><a id="api-reference" name="api-reference">API Reference</a></h1>
|
|
135
|
-
<div class="section">
|
|
136
|
-
<h2><a id="errors" name="errors">Errors</a></h2>
|
|
137
|
-
<p>
|
|
138
|
-
<a name="fn-alreadycallederror"></a>
|
|
139
|
-
<a class="mochidef reference" href="#fn-alreadycallederror">AlreadyCalledError</a>:</p>
|
|
140
|
-
<blockquote>
|
|
141
|
-
<p>Thrown by a <a class="mochiref reference" href="#fn-deferred">Deferred</a> if <tt class="docutils literal"><span class="pre">.callback</span></tt> or <tt class="docutils literal"><span class="pre">.errback</span></tt>
|
|
142
|
-
are called more than once.</p>
|
|
143
|
-
<dl class="docutils">
|
|
144
|
-
<dt><em>Availability</em>:</dt>
|
|
145
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
146
|
-
</dl>
|
|
147
|
-
</blockquote>
|
|
148
|
-
<p>
|
|
149
|
-
<a name="fn-browsercomplianceerror"></a>
|
|
150
|
-
<a class="mochidef reference" href="#fn-browsercomplianceerror">BrowserComplianceError</a>:</p>
|
|
151
|
-
<blockquote>
|
|
152
|
-
<p>Thrown when the JavaScript runtime is not capable of performing
|
|
153
|
-
the given function. Currently, this happens if the browser does
|
|
154
|
-
not support <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt>.</p>
|
|
155
|
-
<dl class="docutils">
|
|
156
|
-
<dt><em>Availability</em>:</dt>
|
|
157
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
158
|
-
</dl>
|
|
159
|
-
</blockquote>
|
|
160
|
-
<p>
|
|
161
|
-
<a name="fn-cancellederror"></a>
|
|
162
|
-
<a class="mochidef reference" href="#fn-cancellederror">CancelledError</a>:</p>
|
|
163
|
-
<blockquote>
|
|
164
|
-
<p>Thrown by a <a class="mochiref reference" href="#fn-deferred">Deferred</a> when it is cancelled, unless a
|
|
165
|
-
canceller is present and throws something else.</p>
|
|
166
|
-
<dl class="docutils">
|
|
167
|
-
<dt><em>Availability</em>:</dt>
|
|
168
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
169
|
-
</dl>
|
|
170
|
-
</blockquote>
|
|
171
|
-
<p>
|
|
172
|
-
<a name="fn-genericerror"></a>
|
|
173
|
-
<a class="mochidef reference" href="#fn-genericerror">GenericError</a>:</p>
|
|
174
|
-
<blockquote>
|
|
175
|
-
<p>Results passed to <tt class="docutils literal"><span class="pre">.fail</span></tt> or <tt class="docutils literal"><span class="pre">.errback</span></tt> of a
|
|
176
|
-
<a class="mochiref reference" href="#fn-deferred">Deferred</a> are wrapped by this <tt class="docutils literal"><span class="pre">Error</span></tt> if <tt class="docutils literal"><span class="pre">!(result</span>
|
|
177
|
-
<span class="pre">instanceof</span> <span class="pre">Error)</span></tt>.</p>
|
|
178
|
-
<dl class="docutils">
|
|
179
|
-
<dt><em>Availability</em>:</dt>
|
|
180
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
181
|
-
</dl>
|
|
182
|
-
</blockquote>
|
|
183
|
-
<p>
|
|
184
|
-
<a name="fn-xmlhttprequesterror"></a>
|
|
185
|
-
<a class="mochidef reference" href="#fn-xmlhttprequesterror">XMLHttpRequestError</a>:</p>
|
|
186
|
-
<blockquote>
|
|
187
|
-
<p>Thrown when an <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> does not complete successfully
|
|
188
|
-
for any reason. The <tt class="docutils literal"><span class="pre">req</span></tt> property of the error is the failed
|
|
189
|
-
<tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> object, and for convenience the <tt class="docutils literal"><span class="pre">number</span></tt>
|
|
190
|
-
property corresponds to <tt class="docutils literal"><span class="pre">req.status</span></tt>.</p>
|
|
191
|
-
<dl class="docutils">
|
|
192
|
-
<dt><em>Availability</em>:</dt>
|
|
193
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
194
|
-
</dl>
|
|
195
|
-
</blockquote>
|
|
196
|
-
</div>
|
|
197
|
-
<div class="section">
|
|
198
|
-
<h2><a id="constructors" name="constructors">Constructors</a></h2>
|
|
199
|
-
<p>
|
|
200
|
-
<a name="fn-deferred"></a>
|
|
201
|
-
<a class="mochidef reference" href="#fn-deferred">Deferred()</a>:</p>
|
|
202
|
-
<blockquote>
|
|
203
|
-
Encapsulates a sequence of callbacks in response to a value that
|
|
204
|
-
may not yet be available. This is modeled after the Deferred class
|
|
205
|
-
from Twisted <a class="footnote-reference" href="#id9" id="id3" name="id3">[3]</a>.</blockquote>
|
|
206
|
-
<blockquote>
|
|
207
|
-
<p>Why do we want this? JavaScript has no threads, and even if it
|
|
208
|
-
did, threads are hard. Deferreds are a way of abstracting
|
|
209
|
-
non-blocking events, such as the final response to an
|
|
210
|
-
<tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt>.</p>
|
|
211
|
-
<p>The sequence of callbacks is internally represented as a list of
|
|
212
|
-
2-tuples containing the callback/errback pair. For example, the
|
|
213
|
-
following call sequence:</p>
|
|
214
|
-
<pre class="literal-block">
|
|
215
|
-
var d = new Deferred();
|
|
216
|
-
d.addCallback(myCallback);
|
|
217
|
-
d.addErrback(myErrback);
|
|
218
|
-
d.addBoth(myBoth);
|
|
219
|
-
d.addCallbacks(myCallback, myErrback);
|
|
220
|
-
</pre>
|
|
221
|
-
<p>is translated into a <a class="mochiref reference" href="#fn-deferred">Deferred</a> with the following
|
|
222
|
-
internal representation:</p>
|
|
223
|
-
<pre class="literal-block">
|
|
224
|
-
[
|
|
225
|
-
[myCallback, null],
|
|
226
|
-
[null, myErrback],
|
|
227
|
-
[myBoth, myBoth],
|
|
228
|
-
[myCallback, myErrback]
|
|
229
|
-
]
|
|
230
|
-
</pre>
|
|
231
|
-
<p>The <a class="mochiref reference" href="#fn-deferred">Deferred</a> also keeps track of its current status
|
|
232
|
-
(fired). Its status may be one of the following three values:</p>
|
|
233
|
-
<blockquote>
|
|
234
|
-
<table border="1" class="docutils">
|
|
235
|
-
<colgroup>
|
|
236
|
-
<col width="14%" />
|
|
237
|
-
<col width="86%" />
|
|
238
|
-
</colgroup>
|
|
239
|
-
<thead valign="bottom">
|
|
240
|
-
<tr><th class="head">Value</th>
|
|
241
|
-
<th class="head">Condition</th>
|
|
242
|
-
</tr>
|
|
243
|
-
</thead>
|
|
244
|
-
<tbody valign="top">
|
|
245
|
-
<tr><td>-1</td>
|
|
246
|
-
<td>no value yet (initial condition)</td>
|
|
247
|
-
</tr>
|
|
248
|
-
<tr><td>0</td>
|
|
249
|
-
<td>success</td>
|
|
250
|
-
</tr>
|
|
251
|
-
<tr><td>1</td>
|
|
252
|
-
<td>error</td>
|
|
253
|
-
</tr>
|
|
254
|
-
</tbody>
|
|
255
|
-
</table>
|
|
256
|
-
</blockquote>
|
|
257
|
-
<p>A <a class="mochiref reference" href="#fn-deferred">Deferred</a> will be in the error state if one of the
|
|
258
|
-
following conditions are met:</p>
|
|
259
|
-
<ol class="arabic simple">
|
|
260
|
-
<li>The result given to callback or errback is "<tt class="docutils literal"><span class="pre">instanceof</span>
|
|
261
|
-
<span class="pre">Error</span></tt>"</li>
|
|
262
|
-
<li>The callback or errback threw while executing. If the thrown
|
|
263
|
-
object is not <tt class="docutils literal"><span class="pre">instanceof</span> <span class="pre">Error</span></tt>, it will be wrapped with
|
|
264
|
-
<a class="mochiref reference" href="#fn-genericerror">GenericError</a>.</li>
|
|
265
|
-
</ol>
|
|
266
|
-
<p>Otherwise, the <a class="mochiref reference" href="#fn-deferred">Deferred</a> will be in the success
|
|
267
|
-
state. The state of the <a class="mochiref reference" href="#fn-deferred">Deferred</a> determines the next
|
|
268
|
-
element in the callback sequence to run.</p>
|
|
269
|
-
<p>When a callback or errback occurs with the example deferred chain,
|
|
270
|
-
something equivalent to the following will happen (imagine that
|
|
271
|
-
exceptions are caught and returned as-is):</p>
|
|
272
|
-
<pre class="literal-block">
|
|
273
|
-
// d.callback(result) or d.errback(result)
|
|
274
|
-
if (!(result instanceof Error)) {
|
|
275
|
-
result = myCallback(result);
|
|
276
|
-
}
|
|
277
|
-
if (result instanceof Error) {
|
|
278
|
-
result = myErrback(result);
|
|
279
|
-
}
|
|
280
|
-
result = myBoth(result);
|
|
281
|
-
if (result instanceof Error) {
|
|
282
|
-
result = myErrback(result);
|
|
283
|
-
} else {
|
|
284
|
-
result = myCallback(result);
|
|
285
|
-
}
|
|
286
|
-
</pre>
|
|
287
|
-
<p>The result is then stored away in case another step is added to
|
|
288
|
-
the callback sequence. Since the <a class="mochiref reference" href="#fn-deferred">Deferred</a> already has
|
|
289
|
-
a value available, any new callbacks added will be called
|
|
290
|
-
immediately.</p>
|
|
291
|
-
<p>There are two other "advanced" details about this implementation
|
|
292
|
-
that are useful:</p>
|
|
293
|
-
<p>Callbacks are allowed to return <a class="mochiref reference" href="#fn-deferred">Deferred</a> instances, so
|
|
294
|
-
you can build complicated sequences of events with (relative)
|
|
295
|
-
ease.</p>
|
|
296
|
-
<p>The creator of the <a class="mochiref reference" href="#fn-deferred">Deferred</a> may specify a
|
|
297
|
-
canceller. The canceller is a function that will be called if
|
|
298
|
-
<a class="mochiref reference" href="#fn-deferred.prototype.cancel">Deferred.prototype.cancel</a> is called before the
|
|
299
|
-
<a class="mochiref reference" href="#fn-deferred">Deferred</a> fires. You can use this to allow an
|
|
300
|
-
<tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> to be cleanly cancelled, for example. Note that
|
|
301
|
-
cancel will fire the <a class="mochiref reference" href="#fn-deferred">Deferred</a> with a
|
|
302
|
-
<a class="mochiref reference" href="#fn-cancellederror">CancelledError</a> (unless your canceller throws or
|
|
303
|
-
returns a different <tt class="docutils literal"><span class="pre">Error</span></tt>), so errbacks should be prepared to
|
|
304
|
-
handle that <tt class="docutils literal"><span class="pre">Error</span></tt> gracefully for cancellable
|
|
305
|
-
<a class="mochiref reference" href="#fn-deferred">Deferred</a> instances.</p>
|
|
306
|
-
<dl class="docutils">
|
|
307
|
-
<dt><em>Availability</em>:</dt>
|
|
308
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
309
|
-
</dl>
|
|
310
|
-
</blockquote>
|
|
311
|
-
<p>
|
|
312
|
-
<a name="fn-deferred.prototype.addboth"></a>
|
|
313
|
-
<a class="mochidef reference" href="#fn-deferred.prototype.addboth">Deferred.prototype.addBoth(func)</a>:</p>
|
|
314
|
-
<blockquote>
|
|
315
|
-
<p>Add the same function as both a callback and an errback as the
|
|
316
|
-
next element on the callback sequence. This is useful for code
|
|
317
|
-
that you want to guarantee to run, e.g. a finalizer.</p>
|
|
318
|
-
<p>If additional arguments are given, then <tt class="docutils literal"><span class="pre">func</span></tt> will be replaced
|
|
319
|
-
with <a class="mochiref reference" href="Base.html#fn-partial">MochiKit.Base.partial.apply(null,
|
|
320
|
-
arguments)</a>. This differs from <a class="reference" href="http://twistedmatrix.com/">Twisted</a>, because the result of
|
|
321
|
-
the callback or errback will be the <em>last</em> argument passed to
|
|
322
|
-
<tt class="docutils literal"><span class="pre">func</span></tt>.</p>
|
|
323
|
-
<p>If <tt class="docutils literal"><span class="pre">func</span></tt> returns a <a class="mochiref reference" href="#fn-deferred">Deferred</a>, then it will be
|
|
324
|
-
chained (its value or error will be passed to the next
|
|
325
|
-
callback). Note that once the returned <tt class="docutils literal"><span class="pre">Deferred</span></tt> is chained, it
|
|
326
|
-
can no longer accept new callbacks.</p>
|
|
327
|
-
<dl class="docutils">
|
|
328
|
-
<dt><em>Availability</em>:</dt>
|
|
329
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
330
|
-
</dl>
|
|
331
|
-
</blockquote>
|
|
332
|
-
<p>
|
|
333
|
-
<a name="fn-deferred.prototype.addcallback"></a>
|
|
334
|
-
<a class="mochidef reference" href="#fn-deferred.prototype.addcallback">Deferred.prototype.addCallback(func[, ...])</a>:</p>
|
|
335
|
-
<blockquote>
|
|
336
|
-
<p>Add a single callback to the end of the callback sequence.</p>
|
|
337
|
-
<p>If additional arguments are given, then <tt class="docutils literal"><span class="pre">func</span></tt> will be replaced
|
|
338
|
-
with <a class="mochiref reference" href="Base.html#fn-partial">MochiKit.Base.partial.apply(null,
|
|
339
|
-
arguments)</a>. This differs from <a class="reference" href="http://twistedmatrix.com/">Twisted</a>, because the result of
|
|
340
|
-
the callback will be the <em>last</em> argument passed to <tt class="docutils literal"><span class="pre">func</span></tt>.</p>
|
|
341
|
-
<p>If <tt class="docutils literal"><span class="pre">func</span></tt> returns a <a class="mochiref reference" href="#fn-deferred">Deferred</a>, then it will be
|
|
342
|
-
chained (its value or error will be passed to the next
|
|
343
|
-
callback). Note that once the returned <tt class="docutils literal"><span class="pre">Deferred</span></tt> is chained, it
|
|
344
|
-
can no longer accept new callbacks.</p>
|
|
345
|
-
<dl class="docutils">
|
|
346
|
-
<dt><em>Availability</em>:</dt>
|
|
347
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
348
|
-
</dl>
|
|
349
|
-
</blockquote>
|
|
350
|
-
<p>
|
|
351
|
-
<a name="fn-deferred.prototype.addcallbacks"></a>
|
|
352
|
-
<a class="mochidef reference" href="#fn-deferred.prototype.addcallbacks">Deferred.prototype.addCallbacks(callback, errback)</a>:</p>
|
|
353
|
-
<blockquote>
|
|
354
|
-
<p>Add separate callback and errback to the end of the callback
|
|
355
|
-
sequence. Either callback or errback may be <tt class="docutils literal"><span class="pre">null</span></tt>, but not
|
|
356
|
-
both.</p>
|
|
357
|
-
<p>If <tt class="docutils literal"><span class="pre">callback</span></tt> or <tt class="docutils literal"><span class="pre">errback</span></tt> returns a <a class="mochiref reference" href="#fn-deferred">Deferred</a>,
|
|
358
|
-
then it will be chained (its value or error will be passed to the
|
|
359
|
-
next callback). Note that once the returned <tt class="docutils literal"><span class="pre">Deferred</span></tt> is
|
|
360
|
-
chained, it can no longer accept new callbacks.</p>
|
|
361
|
-
<dl class="docutils">
|
|
362
|
-
<dt><em>Availability</em>:</dt>
|
|
363
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
364
|
-
</dl>
|
|
365
|
-
</blockquote>
|
|
366
|
-
<p>
|
|
367
|
-
<a name="fn-deferred.prototype.adderrback"></a>
|
|
368
|
-
<a class="mochidef reference" href="#fn-deferred.prototype.adderrback">Deferred.prototype.addErrback(func)</a>:</p>
|
|
369
|
-
<blockquote>
|
|
370
|
-
<p>Add a single errback to the end of the callback sequence.</p>
|
|
371
|
-
<p>If additional arguments are given, then <tt class="docutils literal"><span class="pre">func</span></tt> will be replaced
|
|
372
|
-
with <a class="mochiref reference" href="Base.html#fn-partial">MochiKit.Base.partial.apply(null,
|
|
373
|
-
arguments)</a>. This differs from <a class="reference" href="http://twistedmatrix.com/">Twisted</a>, because the result of
|
|
374
|
-
the errback will be the <em>last</em> argument passed to <tt class="docutils literal"><span class="pre">func</span></tt>.</p>
|
|
375
|
-
<p>If <tt class="docutils literal"><span class="pre">func</span></tt> returns a <a class="mochiref reference" href="#fn-deferred">Deferred</a>, then it will be
|
|
376
|
-
chained (its value or error will be passed to the next
|
|
377
|
-
callback). Note that once the returned <tt class="docutils literal"><span class="pre">Deferred</span></tt> is chained, it
|
|
378
|
-
can no longer accept new callbacks.</p>
|
|
379
|
-
<dl class="docutils">
|
|
380
|
-
<dt><em>Availability</em>:</dt>
|
|
381
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
382
|
-
</dl>
|
|
383
|
-
</blockquote>
|
|
384
|
-
<p>
|
|
385
|
-
<a name="fn-deferred.prototype.callback"></a>
|
|
386
|
-
<a class="mochidef reference" href="#fn-deferred.prototype.callback">Deferred.prototype.callback([result])</a>:</p>
|
|
387
|
-
<blockquote>
|
|
388
|
-
<p>Begin the callback sequence with a non-<tt class="docutils literal"><span class="pre">Error</span></tt> result. Result
|
|
389
|
-
may be any value except for a <a class="mochiref reference" href="#fn-deferred">Deferred</a>.</p>
|
|
390
|
-
<p>Either <tt class="docutils literal"><span class="pre">.callback</span></tt> or <tt class="docutils literal"><span class="pre">.errback</span></tt> should be called exactly once
|
|
391
|
-
on a <a class="mochiref reference" href="#fn-deferred">Deferred</a>.</p>
|
|
392
|
-
<dl class="docutils">
|
|
393
|
-
<dt><em>Availability</em>:</dt>
|
|
394
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
395
|
-
</dl>
|
|
396
|
-
</blockquote>
|
|
397
|
-
<p>
|
|
398
|
-
<a name="fn-deferred.prototype.cancel"></a>
|
|
399
|
-
<a class="mochidef reference" href="#fn-deferred.prototype.cancel">Deferred.prototype.cancel()</a>:</p>
|
|
400
|
-
<blockquote>
|
|
401
|
-
<p>Cancels a <a class="mochiref reference" href="#fn-deferred">Deferred</a> that has not yet received a value,
|
|
402
|
-
or is waiting on another <a class="mochiref reference" href="#fn-deferred">Deferred</a> as its value.</p>
|
|
403
|
-
<p>If a canceller is defined, the canceller is called. If the
|
|
404
|
-
canceller did not return an <tt class="docutils literal"><span class="pre">Error</span></tt>, or there was no canceller,
|
|
405
|
-
then the errback chain is started with <a class="mochiref reference" href="#fn-cancellederror">CancelledError</a>.</p>
|
|
406
|
-
<dl class="docutils">
|
|
407
|
-
<dt><em>Availability</em>:</dt>
|
|
408
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
409
|
-
</dl>
|
|
410
|
-
</blockquote>
|
|
411
|
-
<p>
|
|
412
|
-
<a name="fn-deferred.prototype.errback"></a>
|
|
413
|
-
<a class="mochidef reference" href="#fn-deferred.prototype.errback">Deferred.prototype.errback([result])</a>:</p>
|
|
414
|
-
<blockquote>
|
|
415
|
-
<p>Begin the callback sequence with an error result. Result may be
|
|
416
|
-
any value except for a <a class="mochiref reference" href="#fn-deferred">Deferred</a>, but if <tt class="docutils literal"><span class="pre">!(result</span>
|
|
417
|
-
<span class="pre">instanceof</span> <span class="pre">Error)</span></tt>, it will be wrapped with
|
|
418
|
-
<a class="mochiref reference" href="#fn-genericerror">GenericError</a>.</p>
|
|
419
|
-
<p>Either <tt class="docutils literal"><span class="pre">.callback</span></tt> or <tt class="docutils literal"><span class="pre">.errback</span></tt> should be called exactly once
|
|
420
|
-
on a
|
|
421
|
-
<a name="fn-deferred"></a>
|
|
422
|
-
<a class="mochidef reference" href="#fn-deferred">Deferred</a>.</p>
|
|
423
|
-
<dl class="docutils">
|
|
424
|
-
<dt><em>Availability</em>:</dt>
|
|
425
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
426
|
-
</dl>
|
|
427
|
-
</blockquote>
|
|
428
|
-
<p>
|
|
429
|
-
<a name="fn-deferredlock"></a>
|
|
430
|
-
<a class="mochidef reference" href="#fn-deferredlock">DeferredLock()</a>:</p>
|
|
431
|
-
<blockquote>
|
|
432
|
-
<p>A lock for asynchronous systems.</p>
|
|
433
|
-
<p>The <tt class="docutils literal"><span class="pre">locked</span></tt> property of a <a class="mochiref reference" href="#fn-deferredlock">DeferredLock</a> will be
|
|
434
|
-
<tt class="docutils literal"><span class="pre">true</span></tt> if it locked, <tt class="docutils literal"><span class="pre">false</span></tt> otherwise. Do not change this
|
|
435
|
-
property.</p>
|
|
436
|
-
<dl class="docutils">
|
|
437
|
-
<dt><em>Availability</em>:</dt>
|
|
438
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
439
|
-
</dl>
|
|
440
|
-
</blockquote>
|
|
441
|
-
<p>
|
|
442
|
-
<a name="fn-deferredlock.prototype.acquire"></a>
|
|
443
|
-
<a class="mochidef reference" href="#fn-deferredlock.prototype.acquire">DeferredLock.prototype.acquire()</a>:</p>
|
|
444
|
-
<blockquote>
|
|
445
|
-
<p>Attempt to acquire the lock. Returns a <a class="mochiref reference" href="#fn-deferred">Deferred</a> that
|
|
446
|
-
fires on lock acquisition with the <a class="mochiref reference" href="#fn-deferredlock">DeferredLock</a> as the
|
|
447
|
-
value. If the lock is locked, then the <a class="mochiref reference" href="#fn-deferred">Deferred</a> goes
|
|
448
|
-
into a waiting list.</p>
|
|
449
|
-
<dl class="docutils">
|
|
450
|
-
<dt><em>Availability</em>:</dt>
|
|
451
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
452
|
-
</dl>
|
|
453
|
-
</blockquote>
|
|
454
|
-
<p>
|
|
455
|
-
<a name="fn-deferredlock.prototype.release"></a>
|
|
456
|
-
<a class="mochidef reference" href="#fn-deferredlock.prototype.release">DeferredLock.prototype.release()</a>:</p>
|
|
457
|
-
<blockquote>
|
|
458
|
-
<p>Release the lock. If there is a waiting list, then the first
|
|
459
|
-
<a class="mochiref reference" href="#fn-deferred">Deferred</a> in that waiting list will be called back.</p>
|
|
460
|
-
<dl class="docutils">
|
|
461
|
-
<dt><em>Availability</em>:</dt>
|
|
462
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
463
|
-
</dl>
|
|
464
|
-
</blockquote>
|
|
465
|
-
<p>
|
|
466
|
-
<a name="fn-deferredlist"></a>
|
|
467
|
-
<a class="mochidef reference" href="#fn-deferredlist">DeferredList(list, [fireOnOneCallback, fireOnOneErrback, consumeErrors, canceller])</a>:</p>
|
|
468
|
-
<blockquote>
|
|
469
|
-
<p>Combine a list of <a class="mochiref reference" href="#fn-deferred">Deferred</a> into one. Track the
|
|
470
|
-
callbacks and return a list of (success, result) tuples, 'success'
|
|
471
|
-
being a boolean indicating whether result is a normal result or an
|
|
472
|
-
error.</p>
|
|
473
|
-
<p>Once created, you have access to all <a class="mochiref reference" href="#fn-deferred">Deferred</a> methods,
|
|
474
|
-
like addCallback, addErrback, addBoth. The behaviour can be
|
|
475
|
-
changed by the following options:</p>
|
|
476
|
-
<dl class="docutils">
|
|
477
|
-
<dt><tt class="docutils literal"><span class="pre">fireOnOneCallback</span></tt>:</dt>
|
|
478
|
-
<dd>Flag for launching the callback once the first Deferred of the
|
|
479
|
-
list has returned.</dd>
|
|
480
|
-
<dt><tt class="docutils literal"><span class="pre">fireOnOneErrback</span></tt>:</dt>
|
|
481
|
-
<dd>Flag for calling the errback at the first error of a Deferred.</dd>
|
|
482
|
-
<dt><tt class="docutils literal"><span class="pre">consumeErrors</span></tt>:</dt>
|
|
483
|
-
<dd>Flag indicating that any errors raised in the Deferreds should
|
|
484
|
-
be consumed by the DeferredList.</dd>
|
|
485
|
-
</dl>
|
|
486
|
-
<p>Example:</p>
|
|
487
|
-
<pre class="literal-block">
|
|
488
|
-
// We need to fetch data from 2 different urls
|
|
489
|
-
var d1 = loadJSONDoc(url1);
|
|
490
|
-
var d2 = loadJSONDoc(url2);
|
|
491
|
-
var l1 = new DeferredList([d1, d2], false, false, true);
|
|
492
|
-
l1.addCallback(function (resultList) {
|
|
493
|
-
MochiKit.Base.map(function (result) {
|
|
494
|
-
if (result[0]) {
|
|
495
|
-
alert("Data is here: " + result[1]);
|
|
496
|
-
} else {
|
|
497
|
-
alert("Got an error: " + result[1]);
|
|
498
|
-
}
|
|
499
|
-
}, resultList);
|
|
500
|
-
});
|
|
501
|
-
</pre>
|
|
502
|
-
<dl class="docutils">
|
|
503
|
-
<dt><em>Availability</em>:</dt>
|
|
504
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
505
|
-
</dl>
|
|
506
|
-
</blockquote>
|
|
507
|
-
</div>
|
|
508
|
-
<div class="section">
|
|
509
|
-
<h2><a id="functions" name="functions">Functions</a></h2>
|
|
510
|
-
<p>
|
|
511
|
-
<a name="fn-calllater"></a>
|
|
512
|
-
<a class="mochidef reference" href="#fn-calllater">callLater(seconds, func[, args...])</a>:</p>
|
|
513
|
-
<blockquote>
|
|
514
|
-
<p>Call <tt class="docutils literal"><span class="pre">func(args...)</span></tt> after at least <tt class="docutils literal"><span class="pre">seconds</span></tt> seconds have
|
|
515
|
-
elapsed. This is a convenience method for:</p>
|
|
516
|
-
<pre class="literal-block">
|
|
517
|
-
func = partial.apply(extend(null, arguments, 1));
|
|
518
|
-
return wait(seconds).addCallback(function (res) { return func() });
|
|
519
|
-
</pre>
|
|
520
|
-
<p>Returns a cancellable <a class="mochiref reference" href="#fn-deferred">Deferred</a>.</p>
|
|
521
|
-
<dl class="docutils">
|
|
522
|
-
<dt><em>Availability</em>:</dt>
|
|
523
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
524
|
-
</dl>
|
|
525
|
-
</blockquote>
|
|
526
|
-
<p>
|
|
527
|
-
<a name="fn-doxhr"></a>
|
|
528
|
-
<a class="mochidef reference" href="#fn-doxhr">doXHR(url[, {option: value, ...}])</a>:</p>
|
|
529
|
-
<blockquote>
|
|
530
|
-
<p>Perform a customized <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> and wrap it with a
|
|
531
|
-
<a class="mochiref reference" href="#fn-deferred">Deferred</a> that may be cancelled.</p>
|
|
532
|
-
<p>Note that only <tt class="docutils literal"><span class="pre">200</span></tt> (OK), <tt class="docutils literal"><span class="pre">201</span></tt> (CREATED),
|
|
533
|
-
<tt class="docutils literal"><span class="pre">204</span></tt> (NO CONTENT) and <tt class="docutils literal"><span class="pre">304</span></tt> (NOT MODIFIED) are considered
|
|
534
|
-
success codes. All other status codes will
|
|
535
|
-
result in an errback with an <tt class="docutils literal"><span class="pre">XMLHttpRequestError</span></tt>.</p>
|
|
536
|
-
<dl class="docutils">
|
|
537
|
-
<dt><tt class="docutils literal"><span class="pre">url</span></tt>:</dt>
|
|
538
|
-
<dd>The URL for this request.</dd>
|
|
539
|
-
</dl>
|
|
540
|
-
<p>The following options are currently accepted:</p>
|
|
541
|
-
<dl class="docutils">
|
|
542
|
-
<dt><tt class="docutils literal"><span class="pre">method</span></tt>:</dt>
|
|
543
|
-
<dd>The HTTP method. Default is <tt class="docutils literal"><span class="pre">'GET'</span></tt>.</dd>
|
|
544
|
-
<dt><tt class="docutils literal"><span class="pre">sendContent</span></tt>:</dt>
|
|
545
|
-
<dd>The content to send (e.g. with POST). Default is no content.</dd>
|
|
546
|
-
<dt><tt class="docutils literal"><span class="pre">queryString</span></tt>:</dt>
|
|
547
|
-
<dd>If present it will be used to build a query string to append to
|
|
548
|
-
the url using <a class="mochiref reference" href="Base.html#fn-querystring">MochiKit.Base.queryString</a>. Default is
|
|
549
|
-
no query string.</dd>
|
|
550
|
-
<dt><tt class="docutils literal"><span class="pre">username</span></tt>:</dt>
|
|
551
|
-
<dd>The username for the request. Default is no username.</dd>
|
|
552
|
-
<dt><tt class="docutils literal"><span class="pre">password</span></tt>:</dt>
|
|
553
|
-
<dd>The password for the request. Default is no password.</dd>
|
|
554
|
-
<dt><tt class="docutils literal"><span class="pre">headers</span></tt>:</dt>
|
|
555
|
-
<dd>Additional headers to set in the request, either as an object
|
|
556
|
-
such as <tt class="docutils literal"><span class="pre">{'Accept':</span> <span class="pre">'text/xml'}</span></tt> or as an Array of 2-Arrays
|
|
557
|
-
<tt class="docutils literal"><span class="pre">[['Accept',</span> <span class="pre">'text/xml']]</span></tt>. Default is no additional headers.</dd>
|
|
558
|
-
<dt><tt class="docutils literal"><span class="pre">mimeType</span></tt>:</dt>
|
|
559
|
-
<dd>An override mime type. The typical use of this is to pass
|
|
560
|
-
'text/xml' to force XMLHttpRequest to attempt to parse responseXML.
|
|
561
|
-
Default is no override.</dd>
|
|
562
|
-
<dt><em>returns</em>:</dt>
|
|
563
|
-
<dd><a class="mochiref reference" href="#fn-deferred">Deferred</a> that will callback with the
|
|
564
|
-
<tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> instance on success</dd>
|
|
565
|
-
<dt><em>Availability</em>:</dt>
|
|
566
|
-
<dd>Available in MochiKit 1.4+.</dd>
|
|
567
|
-
</dl>
|
|
568
|
-
</blockquote>
|
|
569
|
-
<p>
|
|
570
|
-
<a name="fn-dosimplexmlhttprequest"></a>
|
|
571
|
-
<a class="mochidef reference" href="#fn-dosimplexmlhttprequest">doSimpleXMLHttpRequest(url[, queryArguments...])</a>:</p>
|
|
572
|
-
<blockquote>
|
|
573
|
-
<p>Perform a simple <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> and wrap it with a
|
|
574
|
-
<a class="mochiref reference" href="#fn-deferred">Deferred</a> that may be cancelled.</p>
|
|
575
|
-
<p>Note that only <tt class="docutils literal"><span class="pre">200</span></tt> (OK), <tt class="docutils literal"><span class="pre">201</span></tt> (CREATED),
|
|
576
|
-
<tt class="docutils literal"><span class="pre">204</span></tt> (NO CONTENT) and <tt class="docutils literal"><span class="pre">304</span></tt> (NOT MODIFIED) are considered
|
|
577
|
-
success codes. All other status codes will
|
|
578
|
-
result in an errback with an <tt class="docutils literal"><span class="pre">XMLHttpRequestError</span></tt>.</p>
|
|
579
|
-
<dl class="docutils">
|
|
580
|
-
<dt><tt class="docutils literal"><span class="pre">url</span></tt>:</dt>
|
|
581
|
-
<dd>The URL to GET</dd>
|
|
582
|
-
<dt><tt class="docutils literal"><span class="pre">queryArguments</span></tt>:</dt>
|
|
583
|
-
<dd><p class="first">If this function is called with more than one argument, a
|
|
584
|
-
<tt class="docutils literal"><span class="pre">"?"</span></tt> and the result of
|
|
585
|
-
<a class="mochiref reference" href="Base.html#fn-querystring">MochiKit.Base.queryString</a> with the rest of the
|
|
586
|
-
arguments are appended to the URL.</p>
|
|
587
|
-
<p>For example, this will do a GET request to the URL
|
|
588
|
-
<tt class="docutils literal"><span class="pre">http://example.com?bar=baz</span></tt>:</p>
|
|
589
|
-
<pre class="last literal-block">
|
|
590
|
-
doSimpleXMLHttpRequest("http://example.com", {bar: "baz"});
|
|
591
|
-
</pre>
|
|
592
|
-
</dd>
|
|
593
|
-
<dt><em>returns</em>:</dt>
|
|
594
|
-
<dd><a class="mochiref reference" href="#fn-deferred">Deferred</a> that will callback with the
|
|
595
|
-
<tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> instance on success</dd>
|
|
596
|
-
<dt><em>Availability</em>:</dt>
|
|
597
|
-
<dd>Available in MochiKit 1.3.1+. Support for 201 and 204 were added in
|
|
598
|
-
MochiKit 1.4.</dd>
|
|
599
|
-
</dl>
|
|
600
|
-
</blockquote>
|
|
601
|
-
<p>
|
|
602
|
-
<a name="fn-evaljsonrequest"></a>
|
|
603
|
-
<a class="mochidef reference" href="#fn-evaljsonrequest">evalJSONRequest(req)</a>:</p>
|
|
604
|
-
<blockquote>
|
|
605
|
-
<p>Evaluate a JSON <a class="footnote-reference" href="#id10" id="id4" name="id4">[4]</a> <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt></p>
|
|
606
|
-
<dl class="docutils">
|
|
607
|
-
<dt><tt class="docutils literal"><span class="pre">req</span></tt>:</dt>
|
|
608
|
-
<dd>The request whose <tt class="docutils literal"><span class="pre">.responseText</span></tt> property is to be
|
|
609
|
-
evaluated. If the JSON is wrapped in a comment, the comment will
|
|
610
|
-
be stripped before evaluation.</dd>
|
|
611
|
-
<dt><em>returns</em>:</dt>
|
|
612
|
-
<dd>A JavaScript object</dd>
|
|
613
|
-
<dt><em>Availability</em>:</dt>
|
|
614
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
615
|
-
</dl>
|
|
616
|
-
</blockquote>
|
|
617
|
-
<p>
|
|
618
|
-
<a name="fn-fail"></a>
|
|
619
|
-
<a class="mochidef reference" href="#fn-fail">fail([result])</a>:</p>
|
|
620
|
-
<blockquote>
|
|
621
|
-
<p>Return a <a class="mochiref reference" href="#fn-deferred">Deferred</a> that has already had
|
|
622
|
-
<tt class="docutils literal"><span class="pre">.errback(result)</span></tt> called.</p>
|
|
623
|
-
<p>See <tt class="docutils literal"><span class="pre">succeed</span></tt> documentation for rationale.</p>
|
|
624
|
-
<dl class="docutils">
|
|
625
|
-
<dt><tt class="docutils literal"><span class="pre">result</span></tt>:</dt>
|
|
626
|
-
<dd>The result to give to
|
|
627
|
-
<a class="mochiref reference" href="#fn-deferred.prototype.errback">Deferred.prototype.errback(result)</a>.</dd>
|
|
628
|
-
<dt><em>returns</em>:</dt>
|
|
629
|
-
<dd>A <tt class="docutils literal"><span class="pre">new</span></tt> <a class="mochiref reference" href="#fn-deferred">Deferred()</a></dd>
|
|
630
|
-
<dt><em>Availability</em>:</dt>
|
|
631
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
632
|
-
</dl>
|
|
633
|
-
</blockquote>
|
|
634
|
-
<p>
|
|
635
|
-
<a name="fn-gatherresults"></a>
|
|
636
|
-
<a class="mochidef reference" href="#fn-gatherresults">gatherResults(deferreds)</a>:</p>
|
|
637
|
-
<blockquote>
|
|
638
|
-
<p>A convenience function that returns a <a class="mochiref reference" href="#fn-deferredlist">DeferredList</a>
|
|
639
|
-
from the given <tt class="docutils literal"><span class="pre">Array</span></tt> of <a class="mochiref reference" href="#fn-deferred">Deferred</a> instances that
|
|
640
|
-
will callback with an <tt class="docutils literal"><span class="pre">Array</span></tt> of just results when they're
|
|
641
|
-
available, or errback on the first array.</p>
|
|
642
|
-
<dl class="docutils">
|
|
643
|
-
<dt><em>Availability</em>:</dt>
|
|
644
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
645
|
-
</dl>
|
|
646
|
-
</blockquote>
|
|
647
|
-
<p>
|
|
648
|
-
<a name="fn-getxmlhttprequest"></a>
|
|
649
|
-
<a class="mochidef reference" href="#fn-getxmlhttprequest">getXMLHttpRequest()</a>:</p>
|
|
650
|
-
<blockquote>
|
|
651
|
-
<p>Return an <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> compliant object for the current
|
|
652
|
-
platform.</p>
|
|
653
|
-
<p>In order of preference:</p>
|
|
654
|
-
<ul class="simple">
|
|
655
|
-
<li><tt class="docutils literal"><span class="pre">new</span> <span class="pre">XMLHttpRequest()</span></tt></li>
|
|
656
|
-
<li><tt class="docutils literal"><span class="pre">new</span> <span class="pre">ActiveXObject('Msxml2.XMLHTTP')</span></tt></li>
|
|
657
|
-
<li><tt class="docutils literal"><span class="pre">new</span> <span class="pre">ActiveXObject('Microsoft.XMLHTTP')</span></tt></li>
|
|
658
|
-
<li><tt class="docutils literal"><span class="pre">new</span> <span class="pre">ActiveXObject('Msxml2.XMLHTTP.4.0')</span></tt></li>
|
|
659
|
-
</ul>
|
|
660
|
-
<dl class="docutils">
|
|
661
|
-
<dt><em>Availability</em>:</dt>
|
|
662
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
663
|
-
</dl>
|
|
664
|
-
</blockquote>
|
|
665
|
-
<p>
|
|
666
|
-
<a name="fn-maybedeferred"></a>
|
|
667
|
-
<a class="mochidef reference" href="#fn-maybedeferred">maybeDeferred(func[, argument...])</a>:</p>
|
|
668
|
-
<blockquote>
|
|
669
|
-
<p>Call a <tt class="docutils literal"><span class="pre">func</span></tt> with the given arguments and ensure the result is
|
|
670
|
-
a <a class="mochiref reference" href="#fn-deferred">Deferred</a>.</p>
|
|
671
|
-
<dl class="docutils">
|
|
672
|
-
<dt><tt class="docutils literal"><span class="pre">func</span></tt>:</dt>
|
|
673
|
-
<dd>The function to call.</dd>
|
|
674
|
-
<dt><em>returns</em>:</dt>
|
|
675
|
-
<dd>A new <a class="mochiref reference" href="#fn-deferred">Deferred</a> based on the call to <tt class="docutils literal"><span class="pre">func</span></tt>. If
|
|
676
|
-
<tt class="docutils literal"><span class="pre">func</span></tt> does not naturally return a <a class="mochiref reference" href="#fn-deferred">Deferred</a>, its
|
|
677
|
-
result or error value will be wrapped by one.</dd>
|
|
678
|
-
<dt><em>Availability</em>:</dt>
|
|
679
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
680
|
-
</dl>
|
|
681
|
-
</blockquote>
|
|
682
|
-
<p>
|
|
683
|
-
<a name="fn-loadjsondoc"></a>
|
|
684
|
-
<a class="mochidef reference" href="#fn-loadjsondoc">loadJSONDoc(url[, queryArguments...])</a>:</p>
|
|
685
|
-
<blockquote>
|
|
686
|
-
<p>Do a simple <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> to a URL and get the response as a
|
|
687
|
-
JSON <a class="footnote-reference" href="#id10" id="id5" name="id5">[4]</a> document.</p>
|
|
688
|
-
<dl class="docutils">
|
|
689
|
-
<dt><tt class="docutils literal"><span class="pre">url</span></tt>:</dt>
|
|
690
|
-
<dd>The URL to GET</dd>
|
|
691
|
-
<dt><tt class="docutils literal"><span class="pre">queryArguments</span></tt>:</dt>
|
|
692
|
-
<dd><p class="first">If this function is called with more than one argument, a
|
|
693
|
-
<tt class="docutils literal"><span class="pre">"?"</span></tt> and the result of
|
|
694
|
-
<a class="mochiref reference" href="Base.html#fn-querystring">MochiKit.Base.queryString</a> with the rest of the
|
|
695
|
-
arguments are appended to the URL.</p>
|
|
696
|
-
<p>For example, this will do a GET request to the URL
|
|
697
|
-
<tt class="docutils literal"><span class="pre">http://example.com?bar=baz</span></tt>:</p>
|
|
698
|
-
<pre class="last literal-block">
|
|
699
|
-
loadJSONDoc("http://example.com", {bar: "baz"});
|
|
700
|
-
</pre>
|
|
701
|
-
</dd>
|
|
702
|
-
<dt><em>returns</em>:</dt>
|
|
703
|
-
<dd><a class="mochiref reference" href="#fn-deferred">Deferred</a> that will callback with the evaluated
|
|
704
|
-
JSON <a class="footnote-reference" href="#id10" id="id6" name="id6">[4]</a> response upon successful <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt></dd>
|
|
705
|
-
<dt><em>Availability</em>:</dt>
|
|
706
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
707
|
-
</dl>
|
|
708
|
-
</blockquote>
|
|
709
|
-
<p>
|
|
710
|
-
<a name="fn-sendxmlhttprequest"></a>
|
|
711
|
-
<a class="mochidef reference" href="#fn-sendxmlhttprequest">sendXMLHttpRequest(req[, sendContent])</a>:</p>
|
|
712
|
-
<blockquote>
|
|
713
|
-
<p>Set an <tt class="docutils literal"><span class="pre">onreadystatechange</span></tt> handler on an <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt>
|
|
714
|
-
object and send it off. Will return a cancellable
|
|
715
|
-
<a class="mochiref reference" href="#fn-deferred">Deferred</a> that will callback on success.</p>
|
|
716
|
-
<p>Note that only <tt class="docutils literal"><span class="pre">200</span></tt> (OK), <tt class="docutils literal"><span class="pre">201</span></tt> (CREATED),
|
|
717
|
-
<tt class="docutils literal"><span class="pre">204</span></tt> (NO CONTENT) and <tt class="docutils literal"><span class="pre">304</span></tt> (NOT MODIFIED) are considered
|
|
718
|
-
success codes. All other status codes will
|
|
719
|
-
result in an errback with an <tt class="docutils literal"><span class="pre">XMLHttpRequestError</span></tt>.</p>
|
|
720
|
-
<dl class="docutils">
|
|
721
|
-
<dt><tt class="docutils literal"><span class="pre">req</span></tt>:</dt>
|
|
722
|
-
<dd>An preconfigured <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> object (open has been
|
|
723
|
-
called).</dd>
|
|
724
|
-
<dt><tt class="docutils literal"><span class="pre">sendContent</span></tt>:</dt>
|
|
725
|
-
<dd>Optional string or DOM content to send over the
|
|
726
|
-
<tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt>.</dd>
|
|
727
|
-
<dt><em>returns</em>:</dt>
|
|
728
|
-
<dd><a class="mochiref reference" href="#fn-deferred">Deferred</a> that will callback with the
|
|
729
|
-
<tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> instance on success.</dd>
|
|
730
|
-
<dt><em>Availability</em>:</dt>
|
|
731
|
-
<dd>Available in MochiKit 1.3.1+. Support for 201 and 204 were added in
|
|
732
|
-
MochiKit 1.4.</dd>
|
|
733
|
-
</dl>
|
|
734
|
-
</blockquote>
|
|
735
|
-
<p>
|
|
736
|
-
<a name="fn-succeed"></a>
|
|
737
|
-
<a class="mochidef reference" href="#fn-succeed">succeed([result])</a>:</p>
|
|
738
|
-
<blockquote>
|
|
739
|
-
<p>Return a <a class="mochiref reference" href="#fn-deferred">Deferred</a> that has already had
|
|
740
|
-
<tt class="docutils literal"><span class="pre">.callback(result)</span></tt> called.</p>
|
|
741
|
-
<p>This is useful when you're writing synchronous code to an
|
|
742
|
-
asynchronous interface: i.e., some code is calling you expecting a
|
|
743
|
-
<a class="mochiref reference" href="#fn-deferred">Deferred</a> result, but you don't actually need to do
|
|
744
|
-
anything asynchronous. Just return <tt class="docutils literal"><span class="pre">succeed(theResult)</span></tt>.</p>
|
|
745
|
-
<p>See <tt class="docutils literal"><span class="pre">fail</span></tt> for a version of this function that uses a failing
|
|
746
|
-
<a class="mochiref reference" href="#fn-deferred">Deferred</a> rather than a successful one.</p>
|
|
747
|
-
<dl class="docutils">
|
|
748
|
-
<dt><tt class="docutils literal"><span class="pre">result</span></tt>:</dt>
|
|
749
|
-
<dd>The result to give to
|
|
750
|
-
<a class="mochiref reference" href="#fn-deferred.prototype.callback">Deferred.prototype.callback(result)</a></dd>
|
|
751
|
-
<dt><em>returns</em>:</dt>
|
|
752
|
-
<dd>a <tt class="docutils literal"><span class="pre">new</span></tt> <a class="mochiref reference" href="#fn-deferred">Deferred</a></dd>
|
|
753
|
-
<dt><em>Availability</em>:</dt>
|
|
754
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
755
|
-
</dl>
|
|
756
|
-
</blockquote>
|
|
757
|
-
<p>
|
|
758
|
-
<a name="fn-wait"></a>
|
|
759
|
-
<a class="mochidef reference" href="#fn-wait">wait(seconds[, res])</a>:</p>
|
|
760
|
-
<blockquote>
|
|
761
|
-
<p>Return a new cancellable <a class="mochiref reference" href="#fn-deferred">Deferred</a> that will
|
|
762
|
-
<tt class="docutils literal"><span class="pre">.callback(res)</span></tt> after at least <tt class="docutils literal"><span class="pre">seconds</span></tt> seconds have
|
|
763
|
-
elapsed.</p>
|
|
764
|
-
<dl class="docutils">
|
|
765
|
-
<dt><em>Availability</em>:</dt>
|
|
766
|
-
<dd>Available in MochiKit 1.3.1+</dd>
|
|
767
|
-
</dl>
|
|
768
|
-
</blockquote>
|
|
769
|
-
</div>
|
|
770
|
-
</div>
|
|
771
|
-
<div class="section">
|
|
772
|
-
<h1><a id="see-also" name="see-also">See Also</a></h1>
|
|
773
|
-
<table class="docutils footnote" frame="void" id="id7" rules="none">
|
|
774
|
-
<colgroup><col class="label" /><col /></colgroup>
|
|
775
|
-
<tbody valign="top">
|
|
776
|
-
<tr><td class="label"><a class="fn-backref" href="#id1" name="id7">[1]</a></td><td>AJAX, Asynchronous JavaScript and XML: <a class="reference" href="http://en.wikipedia.org/wiki/AJAX">http://en.wikipedia.org/wiki/AJAX</a></td></tr>
|
|
777
|
-
</tbody>
|
|
778
|
-
</table>
|
|
779
|
-
<table class="docutils footnote" frame="void" id="id8" rules="none">
|
|
780
|
-
<colgroup><col class="label" /><col /></colgroup>
|
|
781
|
-
<tbody valign="top">
|
|
782
|
-
<tr><td class="label"><a class="fn-backref" href="#id2" name="id8">[2]</a></td><td>Twisted, an event-driven networking framework written in Python: <a class="reference" href="http://twistedmatrix.com/">http://twistedmatrix.com/</a></td></tr>
|
|
783
|
-
</tbody>
|
|
784
|
-
</table>
|
|
785
|
-
<table class="docutils footnote" frame="void" id="id9" rules="none">
|
|
786
|
-
<colgroup><col class="label" /><col /></colgroup>
|
|
787
|
-
<tbody valign="top">
|
|
788
|
-
<tr><td class="label"><a class="fn-backref" href="#id3" name="id9">[3]</a></td><td>Twisted Deferred Reference: <a class="reference" href="http://twistedmatrix.com/projects/core/documentation/howto/defer.html">http://twistedmatrix.com/projects/core/documentation/howto/defer.html</a></td></tr>
|
|
789
|
-
</tbody>
|
|
790
|
-
</table>
|
|
791
|
-
<table class="docutils footnote" frame="void" id="id10" rules="none">
|
|
792
|
-
<colgroup><col class="label" /><col /></colgroup>
|
|
793
|
-
<tbody valign="top">
|
|
794
|
-
<tr><td class="label"><a name="id10">[4]</a></td><td><em>(<a class="fn-backref" href="#id4">1</a>, <a class="fn-backref" href="#id5">2</a>, <a class="fn-backref" href="#id6">3</a>)</em> JSON, JavaScript Object Notation: <a class="reference" href="http://json.org/">http://json.org/</a></td></tr>
|
|
795
|
-
</tbody>
|
|
796
|
-
</table>
|
|
797
|
-
</div>
|
|
798
|
-
<div class="section">
|
|
799
|
-
<h1><a id="authors" name="authors">Authors</a></h1>
|
|
800
|
-
<ul class="simple">
|
|
801
|
-
<li>Bob Ippolito <<a class="reference" href="mailto:bob@redivi.com">bob@redivi.com</a>></li>
|
|
802
|
-
</ul>
|
|
803
|
-
</div>
|
|
804
|
-
<div class="section">
|
|
805
|
-
<h1><a id="copyright" name="copyright">Copyright</a></h1>
|
|
806
|
-
<p>Copyright 2005 Bob Ippolito <<a class="reference" href="mailto:bob@redivi.com">bob@redivi.com</a>>. This program is
|
|
807
|
-
dual-licensed free software; you can redistribute it and/or modify it
|
|
808
|
-
under the terms of the <a class="reference" href="http://www.opensource.org/licenses/mit-license.php">MIT License</a> or the <a class="reference" href="http://www.opensource.org/licenses/afl-2.1.php">Academic Free License
|
|
809
|
-
v2.1</a>.</p>
|
|
810
|
-
</div>
|
|
811
|
-
</div>
|
|
812
|
-
|
|
813
|
-
</body>
|
|
814
|
-
</html>
|