ModelAdapter class that implements the IModelAdapter interface. It adapts a React.MutableRefObject<Model> and provides methods to interact with the underlying model.

Type Parameters

  • T extends {} = any

Implements

Constructors

Properties

Accessors

Constructors

Properties

refresh: () => Promise<void>

Asynchronously refreshes the current model.

Type declaration

    • (): Promise<void>
    • Returns Promise<void>

      A Promise that resolves when the model has been refreshed.

setData: (data: Partial<T> | (prevData: T) => Partial<T>) => Promise<void>

Sets the data of the variable.

Type declaration

    • (data: Partial<T> | (prevData: T) => Partial<T>): Promise<void>
    • Parameters

      • data: Partial<T> | (prevData: T) => Partial<T>

        The data to set. It can be a partial object of type T or a function that accepts the previous data and returns a partial object of type T.

      Returns Promise<void>

      • A promise that resolves when the data is set.
toModel: () => Model<T>

Retrieves the current state of the model.

Type declaration

    • (): Model<T>
    • Returns Model<T>

      The current state of the model.

toObject: () => T

Converts the current state of the object to a plain JavaScript object.

Type declaration

    • (): T
    • Returns T

      The object converted to a plain JavaScript object.

toObject

Accessors