# Class StorageManager

本地存储

#### Hierarchy

- StorageManager

- Defined in assets/core/common/storage/StorageManager.ts:6

#####
Index

### Constructors

constructor

### Properties

_id
_iv
_key

### Accessors

encrypted

### Methods

clear
get
getBoolean
getJson
getKey
getNumber
init
remove
set
setUser

## Constructors

### constructor

- new StorageManager(): StorageManager

- #### Returns StorageManager

## Properties

### `Private` _id

_id: string = ...

- Defined in assets/core/common/storage/StorageManager.ts:9

### `Private` _iv

_iv: null | string = null

- Defined in assets/core/common/storage/StorageManager.ts:8

### `Private` _key

_key: null | string = null

- Defined in assets/core/common/storage/StorageManager.ts:7

## Accessors

### `Private` encrypted

- get encrypted(): boolean

- 数据加密开关

  #### Returns boolean

  - Defined in assets/core/common/storage/StorageManager.ts:158

## Methods

### clear

- clear(): void

- 清空整个本地存储

  #### Returns void

  - Defined in assets/core/common/storage/StorageManager.ts:145

### get

- get(key: string, defaultValue?: any): string

- 获取指定关键字的数据

  ### Returns

  #### Parameters

  - ##### key: string

    获取的关键字

  - ##### defaultValue: any = ""

    获取的默认值

  #### Returns string

  - Defined in assets/core/common/storage/StorageManager.ts:81

### getBoolean

- getBoolean(key: string): boolean

- 获取指定关键字的布尔值

  #### Parameters

  - ##### key: string

  #### Returns boolean

  - Defined in assets/core/common/storage/StorageManager.ts:114

### getJson

- getJson(key: string, defaultValue?: any): any

- 获取指定关键字的JSON对象

  #### Parameters

  - ##### key: string

  - ##### `Optional` defaultValue: any

  #### Returns any

  - Defined in assets/core/common/storage/StorageManager.ts:120

### `Private` getKey

- getKey(key: string): string

- 获取数据分组关键字

  #### Parameters

  - ##### key: string

  #### Returns string

  - Defined in assets/core/common/storage/StorageManager.ts:150

### getNumber

- getNumber(key: string, defaultValue?: number): number

- 获取指定关键字的数值

  #### Parameters

  - ##### key: string

  - ##### defaultValue: number = 0

  #### Returns number

  - Defined in assets/core/common/storage/StorageManager.ts:105

### init

- init(key: string, iv: string): void

- 初始化密钥

  #### Parameters

  - ##### key: string

    aes加密的key

  - ##### iv: string

    aes加密的iv

  #### Returns void

  - Defined in assets/core/common/storage/StorageManager.ts:16

### remove

- remove(key: string): void

- 删除指定关键字的数据

  ### Returns

  #### Parameters

  - ##### key: string

    需要移除的关键字

  #### Returns void

  - Defined in assets/core/common/storage/StorageManager.ts:130

### set

- set(key: string, value: any): void

- 存储本地数据

  ### Returns

  #### Parameters

  - ##### key: string

    存储key

  - ##### value: any

    存储值

  #### Returns void

  - Defined in assets/core/common/storage/StorageManager.ts:37

### setUser

- setUser(id: string): void

- 设置用户唯一标识

  #### Parameters

  - ##### id: string

  #### Returns void

  - Defined in assets/core/common/storage/StorageManager.ts:27

Generated using TypeDoc