From a9cb7b620f3bd267b04b70b5c0122ce6e80a7758 Mon Sep 17 00:00:00 2001 From: David Seifried Date: Tue, 20 Sep 2011 10:12:09 -0400 Subject: [PATCH] Actual test commit without comments and such --- popcorn.js | 26 ++++++++++---------------- testDestroy.html | 4 +++- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/popcorn.js b/popcorn.js index 6db21a9..de90f0f 100644 --- a/popcorn.js +++ b/popcorn.js @@ -95,12 +95,11 @@ events[ item ] = null; } - //instance.media.removeEventListener( "timeupdate", function( event ) { - //console.log("HERE"); - //Popcorn.timeUpdate( that, event ); - //}, false ); - - instance.media.removeEventListener( "timeupdate", instance.data.timeUpdateFunction, false ); + if ( instance.media.readyState >= 2 ) { + instance.media.removeEventListener( "timeupdate", instance.data.timeUpdateFunction, false ); + } else { + throw ( "Attempting to remove event listener before event has been added!" ); + } Popcorn.removeInstance( instance ); }; @@ -282,17 +281,12 @@ } else { - that.data.timeUpdateFunction = function( event ) { - console.log( "here" ); - Popcorn.timeUpdate( that, event ); - } + that.data.timeUpdateFunction = function( event ) { + console.log( "in time update" ); + Popcorn.timeUpdate( that, event ); + } - // that.media.addEventListener( "timeupdate", function( event ) { - // console.log("HERE"); - // Popcorn.timeUpdate( that, event ); - //}, false ); - // - that.media.addEventListener( "timeupdate", that.data.timeUpdateFunction, false ); + that.media.addEventListener( "timeupdate", that.data.timeUpdateFunction, false ); } } else { global.setTimeout(function() { diff --git a/testDestroy.html b/testDestroy.html index 94c3894..ca6b604 100644 --- a/testDestroy.html +++ b/testDestroy.html @@ -5,7 +5,7 @@ var popcorn; function destroy() { - Popcorn.destroy( popcorn ); + popcorn.destroy(); } @@ -19,6 +19,8 @@ console.log( "EVENT: ", popcorn.data.events[ item ] ); } + //popcorn.destroy(); + }, false ); -- 2.43.0