top of page
- RIFF -
HOME
ABOUT
EVENTS
VIDEOS
STORE
TABS
BLOG
Home
Groups
RIFF - Music Group
RIFF - Music Group
Public
·
10 members
Join
Discussion
Media
Files
Members
About
Back
Post Not Found
It seems like this post was deleted
Back to discussion
Members
See All Members (10)
bottom of page
function prefetch(nodeList) { if (navigator.connection && (navigator.connection.effectiveType === 'slow-2g' || navigator.connection.effectiveType === '2g')) { return; } if (navigator.deviceMemory && navigator.deviceMemory <= 2) { return; } const fetched = {}; const observer = new IntersectionObserver(function (entries) { entries.forEach(function (entry) { if (entry.isIntersecting) { const link = entry.target.href; if (!fetched[link]) { fetched[link] = true; fetch(link, { priority: 'low' }); } observer.unobserve(entry.target); } }); }); nodeList.forEach(link => observer.observe(link)); } const idleCallback = window.requestIdleCallback || function (cb) { return setTimeout(() => cb(), 1); }; idleCallback(function () { const links = document.querySelectorAll('a[href]'); prefetch(links); });