@wbe/preloads
TypeScript icon, indicating that this package has built-in type declarations

2.3.0 • Public • Published

@wbe/preloads

Preloads assets utilities:

Installation

$ npm install -s @wbe/preloads

preloadImage

Parameters

  • url (string): image URL

Returns

(Promise<HTMLImageElement>): Promise who return image element

Example

import { preloadImage } from "@wbe/preloads";

preloadImage("https://picsum.photos/200/300").then((response) => {
  // image is loaded, do something...
});

preloadImages

Parameters

  • urls (string[]): image URLs array

Returns

(Promise<HTMLImageElement[]>): Promise who return image elements array

Example

import { preloadImages } from "@wbe/preloads";

preloadImages([
  "https://picsum.photos/200/300",
  "https://picsum.photos/200/300",
]).then((response) => {
  // images are loaded, do something...
});

Readme

Keywords

Package Sidebar

Install

npm i @wbe/preloads

Weekly Downloads

1

Version

2.3.0

License

MIT

Unpacked Size

26.4 kB

Total Files

17

Last publish

Collaborators

  • willybe