Type Alias StoreHooks<S>

StoreHooks: {
    beforeBackendSync?: (state: S) => Option<Partial<S>>;
    beforeFrontendSync?: (state: S) => Option<Partial<S>>;
    error?: (error: unknown) => MaybePromise<void>;
}

Type Parameters

Type declaration

  • Optional ReadonlybeforeBackendSync?: (state: S) => Option<Partial<S>>

    Hook that runs before the store sends its state to Rust. Can be used to modify the state before the sync.

    Returning a nullish value will abort the operation.

  • Optional ReadonlybeforeFrontendSync?: (state: S) => Option<Partial<S>>

    Hook that runs before the store attempts to update itself with data coming from Rust. Can be used to modify the state before the changes are applied.

    Returning a nullish value will abort the operation.

  • Optional Readonlyerror?: (error: unknown) => MaybePromise<void>

    Custom error handler.

    console.error
    
MMNEPVFCICPMFPCPTTAAATR