# Class Store<T>

监听者模式

#### Example

    new Store<{
    "foo": [arg1: number, arg2: string],
    "bar": [arg: boolean],
    }>()

#### Type Parameters

- T extends StoreValueMapType

  预设的监听回调类型

- Defined in lib/react/createStore.ts:66

##### Index

### Constructors

constructor

### Properties

onValuesChange?
values

### Methods

getValues
on
setValues

## Constructors

### constructor

- new Store<T extends StoreValueMapType>(
  initialValue: T,
  onValuesChange?: (values: T, prevValues: T) => void,
  ): Store<T>

  #### Type Parameters

  - T extends StoreValueMapType

    预设的监听回调类型

  #### Parameters

  - initialValue: T
  - `Optional` onValuesChange: (values: T, prevValues: T) => void

  #### Returns Store<T>

  - Defined in lib/react/createStore.ts:76

## Properties

### `Optional` onValuesChange

onValuesChange?: (values: T, prevValues: T) => void

全局的数据变化钩子

- Defined in lib/react/createStore.ts:72

### values

values: T

值

- Defined in lib/react/createStore.ts:69

## Methods

### getValues

- getValues<K extends string | number | symbol>(names: K[]): Pick<T, K>

  获取值

  #### Type Parameters

  - K extends string | number | symbol

  #### Parameters

  - names: K[]

    值的名称

  #### Returns Pick<T, K>

  - Defined in lib/react/createStore.ts:106

### on

- on<K extends string | number | symbol>(
  names: K[],
  callback: (values: Pick<T, K>, prevValues: Pick<T, K>) => void,
  ): () => void

  监听数据变化

  #### Type Parameters

  - K extends string | number | symbol

  #### Parameters

  - names: K[]

    监听的字段名称

  - callback: (values: Pick<T, K>, prevValues: Pick<T, K>) => void

    回调函数

  #### Returns () => void

  解除监听数据变化

  - Defined in lib/react/createStore.ts:88

### setValues

- setValues<K extends string | number | symbol>(
  names: K[],
  values: Pick<T, K>,
  ): void

  设置值

  #### Type Parameters

  - K extends string | number | symbol

  #### Parameters

  - names: K[]
  - values: Pick<T, K>

    设置值

  #### Returns void

  - Defined in lib/react/createStore.ts:114