variable / @typed/async-data

loading

Creates a loading state with optional progress.

Package version
1.0.0-beta.7
Category
State construction
Since
1.0.0

Import

import { loading } from "@typed/async-data";

Signatures

export declare const loading: (progress?: Progress) => Loading;

Why

The constructor keeps state creation consistent with the discriminated union.

Ownership and lifetime

This pure function acquires no resources and returns a new wrapper.

Examples

import { loading } from "@typed/async-data"
const state = loading({ loaded: 2, total: 5 })

Source