Skip to content

Commit 9e3ae07

Browse files
committed
1 parent 9a551f3 commit 9e3ae07

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/pat/inject/inject.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ const inject = {
675675
title = sources$[sources$.length - 1];
676676
}
677677
cfgs.forEach((cfg, idx1) => {
678-
function perform_inject() {
678+
const perform_inject = () => {
679679
if (cfg.target != "none")
680680
cfg.$target.each((idx2, target) => {
681681
this._performInjection(
@@ -687,11 +687,11 @@ const inject = {
687687
title
688688
);
689689
});
690-
}
690+
};
691691
if (cfg.processDelay) {
692-
setTimeout(() => perform_inject.bind(this)(), cfg.processDelay);
692+
setTimeout(() => perform_inject(), cfg.processDelay);
693693
} else {
694-
perform_inject.bind(this)();
694+
perform_inject();
695695
}
696696
});
697697
if (cfgs[0].nextHref && $el.is("a")) {
@@ -964,15 +964,15 @@ const inject = {
964964
const $scrollable = $el.parents(":scrollable");
965965

966966
// function to trigger the autoload and mark as triggered
967-
function trigger(event) {
967+
const trigger = (event) => {
968968
if ($el.data("pat-inject-autoloaded")) {
969969
return false;
970970
}
971971
$el.data("pat-inject-autoloaded", true);
972972
this.onTrigger({ target: $el[0] });
973973
event && event.preventDefault();
974974
return true;
975-
}
975+
};
976976
$el.click(trigger);
977977

978978
// Use case 1: a (heigh-constrained) scrollable parent
@@ -1068,11 +1068,11 @@ const inject = {
10681068
const timeout = parseInt(delay, 10);
10691069
let timer;
10701070

1071-
function onTimeout() {
1071+
const onTimeout = () => {
10721072
this.onTrigger({ target: $el[0] });
10731073
unsub();
10741074
clearTimeout(timer);
1075-
}
1075+
};
10761076

10771077
const onInteraction = utils.debounce(() => {
10781078
if (!document.body.contains($el[0])) {
@@ -1083,7 +1083,7 @@ const inject = {
10831083
timer = setTimeout(onTimeout, timeout);
10841084
}, timeout);
10851085

1086-
function unsub() {
1086+
const unsub = () => {
10871087
["scroll", "resize"].forEach((e) =>
10881088
window.removeEventListener(e, onInteraction)
10891089
);
@@ -1095,7 +1095,7 @@ const inject = {
10951095
"touchstart",
10961096
"touchend",
10971097
].forEach((e) => document.removeEventListener(e, onInteraction));
1098-
}
1098+
};
10991099

11001100
onInteraction();
11011101

0 commit comments

Comments
 (0)