[#960183] Ensure we remove ready callbacks when they are called. #368

Open
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants
Contributor

ScottDowne commented Jan 15, 2014

No description provided.

@humphd humphd and 1 other commented on an outdated diff Jan 15, 2014

wrappers/null/popcorn.HTMLNullVideoElement.js
@@ -128,10 +128,9 @@
impl.readyState = self.HAVE_ENOUGH_DATA;
self.dispatchEvent( "canplaythrough" );
- var i = playerReadyCallbacks.length;
- while( i-- ) {
- playerReadyCallbacks[ i ]();
- delete playerReadyCallbacks[ i ];
+ while( playerReadyCallbacks.length ) {
+ playerReadyCallbacks[ 0 ]();
@humphd

humphd Jan 15, 2014

Member

Let's shift first:

var cb = playerReadyCallbacks.shift();
cb();
@ScottDowne

ScottDowne Jan 16, 2014

Contributor

Going to declare the callback at the top of this function scope, but otherwise, no isses.

haha, or playerReadyCallbacks.shift()();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment