Skip to main content
cngx-src documentation

createManualState

Functioncommon/data/async-state

projects/common/data/async-state/create-manual-state.ts

Description#

Create a fully manual async state — no HTTP, no automatic loading.

Use for local operations: heavy computations, Web Workers, complex local processes. Does not require an injection context — uses only signal() and computed().

readonly processState = createManualState<ProcessResult>();

async handleProcess(): Promise<void> {
  this.processState.set('loading');
  this.processState.setProgress(0);
  const result = await heavyComputation((p) => this.processState.setProgress(p));
  this.processState.setSuccess(result);
}

Signature#

createManualState()

Returns#

ManualAsyncState