@types/imagesloaded
TypeScript icon, indicating that this package has built-in type declarations

4.1.6 • Public • Published

Installation

npm install --save @types/imagesloaded

Summary

This package contains type definitions for imagesloaded (https://github.com/desandro/imagesloaded).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/imagesloaded.

index.d.ts

/// <reference types="jquery" />

declare namespace ImagesLoaded {
    type ElementSelector = Element | NodeList | Element[] | string;

    /** interface for an image currently loading or completed */
    interface LoadingImage {
        img: HTMLImageElement;
        isLoaded: boolean;
    }

    interface ImagesLoadedCallback {
        (instance?: ImagesLoaded): void;
    }

    interface ImagesLoadedListener {
        (instance: ImagesLoaded, image?: LoadingImage): void;
    }

    interface ImagesLoaded {
        new(elem: ElementSelector, callback: ImagesLoadedCallback): ImagesLoaded;

        images: LoadingImage[];

        // event listeners
        on(event: string, listener: ImagesLoadedListener): void;
        off(event: string, listener: ImagesLoadedListener): void;
        once(event: string, listener: ImagesLoadedListener): void;
    }

    interface ImagesLoadedOptions {
        background: true | string;
    }

    interface ImagesLoadedConstructor {
        /**
         * Creates a new ImagesLoaded object with the provided callback
         * @param elem Element, NodeList, Element array, or selector string for images to watch
         * @param options object that can tell imagesloaded to watch background images as well
         * @param callback function triggered after all images have been loaded
         */
        (elem: ElementSelector, options: ImagesLoadedOptions, callback?: ImagesLoadedCallback): ImagesLoaded;
        (elem: ElementSelector, callback?: ImagesLoadedCallback): ImagesLoaded;
    }
}

declare var imagesLoaded: ImagesLoaded.ImagesLoadedConstructor;

declare module "imagesloaded" {
    export = imagesLoaded;
}

interface JQuery {
    imagesLoaded(callback?: ImagesLoaded.ImagesLoadedCallback): JQueryDeferred<ImagesLoaded.ImagesLoaded>;
    imagesLoaded(
        options: ImagesLoaded.ImagesLoadedOptions,
        callback?: ImagesLoaded.ImagesLoadedCallback,
    ): JQueryDeferred<ImagesLoaded.ImagesLoaded>;
}

Additional Details

  • Last updated: Mon, 20 Nov 2023 23:36:24 GMT
  • Dependencies: @types/jquery

Credits

These definitions were written by Chris Charabaruk, and Cameron Little.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/imagesloaded

Weekly Downloads

12,408

Version

4.1.6

License

MIT

Unpacked Size

6.81 kB

Total Files

5

Last publish

Collaborators

  • types