javascript - How to pass a variable to a listener/handler function -


I am using projekktor for streaming my video on the browser. I have an event attached to many listeners on state .

  video.addListener ('state', listener1); Video.addListener ('state', listener 2); Video.addListener ('state', listener3);  

The function inside listener3 and when state === 'COMPLETED' I need to remove the listener listener3 The thing is that the listener You need a variable video to delete. Given that the listener3 is a callback, how can I pass variable video in function listener3?

To remove an event listener in javascript use:

Modern Browser:

  Video .removeEventListener ('name', fnName);  

Older means:

  video.detachEvent ('name', fnName);  

DOM Level 0:

  Video '[name' = name] = 'null;  

jQuery:

  video.off ('name');  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -