Skip to content

Commit ae2d2d0

Browse files
Merge pull request #209 from SwiftFiddle/throttle-remove
Remove throttle
2 parents ce6ce78 + f7dc08e commit ae2d2d0

File tree

4 files changed

+6
-48
lines changed

4 files changed

+6
-48
lines changed

Public/js/popover.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"use strict";
22

33
import "../css/popover.css";
4-
import { throttle } from "./throttle.js";
54

65
export class Popover {
76
set maxWidth(value) {
@@ -29,26 +28,19 @@ export class Popover {
2928
this.popover.appendChild(this.popoverContent);
3029
document.body.appendChild(this.popover);
3130

32-
const onmouseover = throttle((event) => {
33-
this.onmouseover(event);
34-
});
35-
const onmouseout = throttle((event) => {
36-
this.onmouseout(event);
37-
});
38-
3931
this.popover.addEventListener(
4032
"mouseenter",
4133
(event) => {
4234
event.stopPropagation();
43-
onmouseover(event);
35+
this.onmouseover(event);
4436
},
4537
{ capture: false, once: false, passive: false }
4638
);
4739
this.popover.addEventListener(
4840
"mouseleave",
4941
(event) => {
5042
event.stopPropagation();
51-
onmouseout(event);
43+
this.onmouseout(event);
5244
},
5345
{ capture: false, once: false, passive: false }
5446
);

Public/js/statistics_view.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import "datatables.net-bs5/css/dataTables.bootstrap5.min.css";
55

66
import "../css/table.css";
77

8-
import { throttle } from "./throttle.js";
9-
108
export class StatisticsView {
119
set error(error) {
1210
this.container.innerHTML = `<div class="alert alert-danger m-3" role="alert">${error}</div>`;
@@ -38,26 +36,19 @@ export class StatisticsView {
3836
tr.innerHTML = `<td style="font-family: Menlo, Consolas, 'DejaVu Sans Mono', 'Ubuntu Mono', monospace;">${row.text}</td><td><div>${row.ranges.length}</div></td>`;
3937
body.appendChild(tr);
4038

41-
const onmouseover = throttle((event, element, data) => {
42-
this.onmouseover(event, element, data);
43-
});
44-
const onmouseout = throttle((event, element, data) => {
45-
this.onmouseout(event, element, data);
46-
});
47-
4839
tr.addEventListener(
4940
"mouseover",
5041
(event) => {
5142
event.stopPropagation();
52-
onmouseover(event, tr, row.ranges);
43+
this.onmouseover(event, tr, row.ranges);
5344
},
5445
{ capture: false, once: false, passive: false }
5546
);
5647
tr.addEventListener(
5748
"mouseout",
5849
(event) => {
5950
event.stopPropagation();
60-
onmouseout(event, tr);
51+
this.onmouseout(event, tr);
6152
},
6253
{ capture: false, once: false, passive: false }
6354
);

Public/js/throttle.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

Public/js/tree_view.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"use strict";
22

33
import "../css/tree_view.css";
4-
import { throttle } from "./throttle.js";
54

65
const downCaret = makeDownCaret();
76
const rightCaret = makeRightCaret();
@@ -83,20 +82,13 @@ export class TreeView {
8382
li.appendChild(element);
8483
}
8584

86-
const onmouseover = throttle((event, element, data) => {
87-
this.onmouseover(event, element, data);
88-
});
89-
const onmouseout = throttle((event, element, data) => {
90-
this.onmouseout(event, element, data);
91-
});
92-
9385
li.addEventListener(
9486
"mouseover",
9587
(event) => {
9688
event.stopPropagation();
9789

9890
li.classList.add("hover");
99-
onmouseover(event, element, node);
91+
this.onmouseover(event, element, node);
10092
},
10193
{ capture: false, once: false, passive: false }
10294
);
@@ -106,7 +98,7 @@ export class TreeView {
10698
event.stopPropagation();
10799

108100
li.classList.remove("hover");
109-
onmouseout(event, element, node);
101+
this.onmouseout(event, element, node);
110102
},
111103
{ capture: false, once: false, passive: false }
112104
);

0 commit comments

Comments
 (0)