mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2025-08-31 22:50:43 +00:00
mark the callback as "passive", should improve performance
see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#using_passive_listeners
This commit is contained in:
parent
b3857c6d9a
commit
2b083287a5
1 changed files with 2 additions and 2 deletions
|
@ -104,13 +104,13 @@ function init() {
|
||||||
nekoEl.value.style.left = `${nekoPosX - 16}px`;
|
nekoEl.value.style.left = `${nekoPosX - 16}px`;
|
||||||
nekoEl.value.style.top = `${nekoPosY - 16}px`;
|
nekoEl.value.style.top = `${nekoPosY - 16}px`;
|
||||||
|
|
||||||
window.document.addEventListener('mousemove', mouseCallback);
|
window.document.addEventListener('mousemove', mouseCallback, { passive: true });
|
||||||
|
|
||||||
window.requestAnimationFrame(onAnimationFrame);
|
window.requestAnimationFrame(onAnimationFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
function uninit() {
|
function uninit() {
|
||||||
window.removeEventListener('mousemove', mouseCallback);
|
window.removeEventListener('mousemove', mouseCallback, { passive: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAnimationFrame(timestamp) {
|
function onAnimationFrame(timestamp) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue