baseframe-js
Version:
Baseframe JS is a comprehensive suite of modular plugins and utilities designed for front-end development
45 lines (44 loc) • 1.43 kB
TypeScript
import type { StringPluginArgChoices } from './types';
import { type BaseElem } from "base-elem-js";
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 {
#private;
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: IntersectionObserverInit;
};
static version: string;
static pluginName: string;
constructor(element: HTMLElement, options: ILazyLoadOptions | StringPluginArgChoices);
static remove(element: BaseElem, plugin?: LazyLoad): void;
}
export interface LazyLoadPlugin {
lazyLoad(options: ILazyLoadOptions | StringPluginArgChoices): BaseElem;
}
declare module 'base-elem-js' {
interface BaseElem extends LazyLoadPlugin {
}
}