Interface ObjectHandle

数据对象的操作方法

interface ObjectHandle {
    get: (<K>(key?) => Promise<Record<K[number], any>>);
    onChange: (<T>(callback) => {
        callback: T;
        id: string;
        remove: (() => void);
    });
    set: ((data) => Promise<boolean>);
}

Hierarchy

  • CommonHandle
    • ObjectHandle

Properties

Properties

get: (<K>(key?) => Promise<Record<K[number], any>>)

获取对象字段值

Type declaration

    • <K>(key?): Promise<Record<K[number], any>>
    • Type Parameters

      • K extends string | string[]

      Parameters

      • Optional key: K

      Returns Promise<Record<K[number], any>>

onChange: (<T>(callback) => {
    callback: T;
    id: string;
    remove: (() => void);
})

监听数据发生变化

Type declaration

    • <T>(callback): {
          callback: T;
          id: string;
          remove: (() => void);
      }
    • Type Parameters

      • T extends ((changeData) => void)

      Parameters

      • callback: T

      Returns {
          callback: T;
          id: string;
          remove: (() => void);
      }

      • callback: T
      • id: string
      • remove: (() => void)
          • (): void
          • Returns void

set: ((data) => Promise<boolean>)

设置对象字段值

Type declaration

    • (data): Promise<boolean>
    • Parameters

      • data: Record<string, any>

      Returns Promise<boolean>