Skip to content

Commit

Permalink
perf: remove add/remove event polyfills\n\nWe don't polyfill these br…
Browse files Browse the repository at this point in the history
…owsers using core-js (i.e. it most likely doesn't work anyway) and barely anyone is using them nowadays. (#1025)
  • Loading branch information
Thomaash authored Nov 2, 2023
1 parent 4e63164 commit 84375b0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions lib/graph3d/Graph3d.js
Original file line number Diff line number Diff line change
Expand Up @@ -526,11 +526,11 @@ Graph3d.prototype.create = function () {
};
// TODO: these events are never cleaned up... can give a 'memory leakage'

util.addEventListener(this.frame.canvas, "mousedown", onmousedown);
util.addEventListener(this.frame.canvas, "touchstart", ontouchstart);
util.addEventListener(this.frame.canvas, "mousewheel", onmousewheel);
util.addEventListener(this.frame.canvas, "mousemove", ontooltip);
util.addEventListener(this.frame.canvas, "click", onclick);
this.frame.canvas.addEventListener("mousedown", onmousedown);
this.frame.canvas.addEventListener("touchstart", ontouchstart);
this.frame.canvas.addEventListener("mousewheel", onmousewheel);
this.frame.canvas.addEventListener("mousemove", ontooltip);
this.frame.canvas.addEventListener("click", onclick);

// add the new graph to the container element
this.containerElement.appendChild(this.frame);
Expand Down Expand Up @@ -2079,8 +2079,8 @@ Graph3d.prototype._onMouseDown = function (event) {
this.onmouseup = function (event) {
me._onMouseUp(event);
};
util.addEventListener(document, "mousemove", me.onmousemove);
util.addEventListener(document, "mouseup", me.onmouseup);
document.addEventListener("mousemove", me.onmousemove);
document.addEventListener("mouseup", me.onmouseup);
util.preventDefault(event);
};

Expand Down Expand Up @@ -2253,8 +2253,8 @@ Graph3d.prototype._onTouchStart = function (event) {
this.ontouchend = function (event) {
me._onTouchEnd(event);
};
util.addEventListener(document, "touchmove", me.ontouchmove);
util.addEventListener(document, "touchend", me.ontouchend);
document.addEventListener("touchmove", me.ontouchmove);
document.addEventListener("touchend", me.ontouchend);

this._onMouseDown(event);
};
Expand Down
4 changes: 2 additions & 2 deletions lib/graph3d/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ Slider.prototype._onMouseDown = function (event) {
this.onmouseup = function (event) {
me._onMouseUp(event);
};
util.addEventListener(document, "mousemove", this.onmousemove);
util.addEventListener(document, "mouseup", this.onmouseup);
document.addEventListener("mousemove", this.onmousemove);
document.addEventListener("mouseup", this.onmouseup);
util.preventDefault(event);
};

Expand Down

0 comments on commit 84375b0

Please sign in to comment.