]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
start & end now check for options.codeReady
authorChristopher De Cairos <chris.decairos@gmail.com>
Mon, 27 Jun 2011 19:31:16 +0000 (15:31 -0400)
committerChristopher De Cairos <chris.decairos@gmail.com>
Mon, 27 Jun 2011 19:31:16 +0000 (15:31 -0400)
plugins/processing/popcorn.processing.js

index 560e4ff1ea8af97c4e315255a062d71e86e9aa1b..6116852beea9132761ed98e7885ccf714658b533 100644 (file)
       },
 
       start: function( event, options ) {
-        toggle.call( this, true, options );
+        var that = this,
+        
+        checkCodeReady = function() {
+          if ( options.codeReady ) {
+            toggle.call( that, true, options );
+            return;
+          }
+          
+          setTimeout( checkCodeReady, 5 );
+          
+        };
+        
+        checkCodeReady();
       },
 
       end: function( event, options ) {
-        toggle.call( this, false, options );
+        var that = this, 
+        
+        checkCodeReady = function() {
+          if ( options.codeReady ) {
+            toggle.call( that, false, options );
+            return;
+          }
+        
+          setTimeout( checkCodeReady, 5 );
+        
+        };
+        
+        checkCodeReady();
       },
       
       _teardown: function( options ) {