baseframe-js
Version:
A suite of useful Javascript plugins and functions to help with Front-end Development on websites
46 lines (45 loc) • 1.42 kB
TypeScript
import type { StringPluginArgChoices } from './types';
import type { Cash } from 'cash-dom';
export interface ILazyLoadDefaults {
observerID: string;
imgSrcName: string | 'src';
bgSrcName: string | 'bgSrc';
loadImgs: boolean;
inEvt(lazyElem: HTMLElement, entry: IntersectionObserverEntry): void;
outEvt(lazyElem: HTMLElement, entry: IntersectionObserverEntry): void;
force: boolean;
unobserve: boolean;
observerOpts: IntersectionObserverInit;
}
export interface ILazyLoadOptions extends Partial<ILazyLoadDefaults> {
observerID: string;
}
export default class LazyLoad {
element: HTMLElement;
params: ILazyLoadDefaults;
lazyElemObserver: IntersectionObserver;
static defaults: {
imgSrcName: string;
bgSrcName: string;
loadImgs: boolean;
inEvt: any;
outEvt: any;
force: boolean;
observerID: any;
unobserve: boolean;
observerOpts: {
rootMargin: string;
};
};
static version: string;
static pluginName: string;
constructor(element: HTMLElement, options: ILazyLoadOptions | StringPluginArgChoices);
static remove(element: Cash, plugin?: LazyLoad): void;
imgAndBg(s: any, lazyElem: any): void;
handleEvents(): void;
}
declare module 'cash-dom' {
interface Cash {
lazyLoad(options: ILazyLoadOptions | StringPluginArgChoices): Cash;
}
}