1
0
mirror of https://github.com/videojs/video.js.git synced 2024-11-28 08:58:46 +02:00

Merge pull request #1386 from Akkuma/feature/optimized-slider-handlers

Bound move/end context once instead of repeatedly
This commit is contained in:
Matthew McClure 2014-08-01 16:47:47 -07:00
commit 8b5eb5089f

View File

@ -26,7 +26,10 @@ vjs.Slider = vjs.Component.extend({
player.on(this.playerEvent, vjs.bind(this, this.update));
this.boundEvents = {};
this.boundEvents = {
move: vjs.bind(this, this.onMouseMove),
end: vjs.bind(this, this.onMouseUp)
};
}
});
@ -49,9 +52,6 @@ vjs.Slider.prototype.onMouseDown = function(event){
event.preventDefault();
vjs.blockTextSelection();
this.boundEvents.move = vjs.bind(this, this.onMouseMove);
this.boundEvents.end = vjs.bind(this, this.onMouseUp);
vjs.on(document, 'mousemove', this.boundEvents.move);
vjs.on(document, 'mouseup', this.boundEvents.end);
vjs.on(document, 'touchmove', this.boundEvents.move);