Commit b0dd7933 authored by Tim Zallmann's avatar Tim Zallmann

Execute mouseout only 'once'

parent ef3024ea
......@@ -34,14 +34,13 @@ export function initPrefetchLinks(selector) {
};
const mouseOverHandler = () => {
el.addEventListener('mouseout', mouseOutHandler, { passive: true });
el.addEventListener('mouseout', mouseOutHandler, { once:true, passive: true });
mouseOverTimer = setTimeout(() => {
if (el.href) prefetchDocument(el.href);
// Only execute once
el.removeEventListener('mouseover', mouseOverHandler, true);
el.removeEventListener('mouseout', mouseOutHandler);
mouseOverTimer = undefined;
}, 100);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment