Custom AsyncSystem
1. Direct Usage
const customAsyncSystem = new AsyncSystemBase(
new ListUnit<string>(), // queryUnit
new DictUnit<{ a: number, b: string }>(), // dataUnit
new GenericUnit<number>(), // errorUnit
new BoolUnit(), // pendingUnit
{clearErrorOnData: false} // config is optional
);
// extract the Units from the System
const {queryUnit, dataUnit, errorUnit, pendingUnit} = customAsyncSystem;
// confirm the type of Units
queryUnit instanceof ListUnit // true
dataUnit instanceof DictUnit // true
errorUnit instanceof GenericUnit // true
pendingUnit instanceof BoolUnit // true2. Extend the AsyncSystemBase class
Implementation:
Usage:
Notes
Last updated
Was this helpful?