@scml/hook-img-loader

TypeScript type definitions for Image loader hook, mounting image loader and allowing mods to provide custom images.

Installation

npm
yarn
pnpm
bun
deno
npm install -D @scml/hook-img-loader

Quick Start

Add type reference

/// <reference types="@scml/hook-img-loader" />

Use global instance

modImgLoaderHooker is mounted on window.

Import types on demand

import type { ImgLoaderHooker } from '@scml/hook-img-loader/ImgLoaderHooker';
import type { ImgLoaderHookerCore } from '@scml/hook-img-loader/ImgLoaderHookerCore';
import type { CssReplacer } from '@scml/hook-img-loader/CssReplacer';

Global Types global

PropertyTypeDescription
modImgLoaderHookerImgLoaderHookerImage loader hook instance
Main entry
Subpath import
/// <reference types="@scml/hook-img-loader" />

Subpath Exports

SubpathDescription
.Main entry, augments Window/global
./ImgLoaderHookerMain class
./ImgLoaderHookerCoreCore implementation
./CssReplacerCSS replace helpers
./NodeMutationObserverDOM observer
./SimpleDolFunctionHookFunction hook
./utilsUtilities
./createFunctionFromCodeGenerate function from code

API Reference

./ImgLoaderHooker

ImgLoaderHooker class

Extends ImgLoaderHookerCore, installs hook and waits for init. Methods: init(), installHook().

./ImgLoaderHookerCore

Core hook infrastructure for image loading and DOM observation.

./CssReplacer

CSS replace helper utilities.

Type Definition Source

INFO