HtmlImages unstable
The image loader, for loading an image the page doesn't show yet.
Models
Since v4.2.0 Source
An image to load, as the <img> attributes of the same names.
Signature
interface ImageSource { readonly crossOrigin?: "anonymous" | "use-credentials"; readonly referrerPolicy?: string; readonly sizes?: string; readonly src?: string; readonly srcSet?: string;}References
Services
Loads images the page doesn't show, such as to show an <img> only once
its source has loaded.
Details
load settles with "loaded" or "error", and interrupting it drops
the load. BrowserHost.layer provides one that loads in a detached
<img> of its document. The default never settles, so on a host without
a document an image stays loading. A test settles loads with TestImages
from effect/ui/html/testing.
Signature
interface Images { readonly load: (source: ImageSource) => Effect<"error" | "loaded">;}