UNPKG

vanilla-lazyload

Version:

LazyLoad is a lightweight (2.4 kB) and flexible script that speeds up your web application by deferring the loading of your below-the-fold images, videos and iframes to when they will enter the viewport. It's written in plain "vanilla" JavaScript, it leve

2 lines (1 loc) 506 B
import{runningOnBrowser as n}from"./environment.js";import{resetStatus as o}from"./data.js";import{removeClass as e}from"./class.js";import{filterErrorElements as r,queryElements as i}from"./dom.js";const t=(n,t)=>{r(i(n)).forEach((r=>{e(r,n.class_error),o(r)})),t.update()},m=(o,e)=>{n&&(e._onlineHandler=()=>{t(o,e)},window.addEventListener("online",e._onlineHandler))},s=o=>{n&&window.removeEventListener("online",o._onlineHandler)};export{s as resetOnlineCheck,t as retryLazyLoad,m as setOnlineCheck};