From: Christopher De Cairos Date: Mon, 27 Jun 2011 19:31:16 +0000 (-0400) Subject: start & end now check for options.codeReady X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=1caba98e5b4c38fa70b39d2345d9f88bc0158fe4;p=popcorn-js.git start & end now check for options.codeReady --- diff --git a/plugins/processing/popcorn.processing.js b/plugins/processing/popcorn.processing.js index 560e4ff..6116852 100644 --- a/plugins/processing/popcorn.processing.js +++ b/plugins/processing/popcorn.processing.js @@ -139,11 +139,35 @@ }, 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 ) {