Commits

Anonymous committed 019e08a

Some try out code involving deferreds.

  • Participants
  • Parent commits 346a667
  • Branches faassen-refactor
  • Tags before_forms2_compat_with_views_broken

Comments (0)

Files changed (2)

File test/testdeferred.html

+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset="UTF-8" />
+    <title>Deferred testing code</title>
+    <link href="jquery-ui-1.8.12.custom.css" rel="stylesheet" type="text/css"/>
+    <script type="text/javascript" src="jquery-1.6.1.js"></script>
+    <script type="text/javascript" src="json-template.js"></script>
+    <script type="text/javascript" src="../src/views2.js"></script>
+    <script type="text/javascript" src="testdeferred.js"></script>
+  </head>
+  <body>
+    <div id="test"></div>
+    <div id="output"></div>
+  </body>
+</html>

File test/testdeferred.js

+
+var $ = jQuery;
+
+$(document).ready(function() {
+    var d1 = $.Deferred();
+    var d2 = $.Deferred();
+    
+    var p1 = $.when.apply(null, [d1, d2]).done(function() {
+        alert("P1");
+    });
+    
+    var p2 = $.when(d1, d2).done(function() {
+        alert("P2");
+    });
+
+    // var p1 = $.when.apply([]).done(function() {
+    //     alert("P empty");
+    // });
+    
+    //d1.resolve();
+    //d2.resolve();
+});
+