# 分布式数据管理子系统JS API变更 OpenHarmony 3.2 Beta1版本相较于OpenHarmony 3.1 Release版本,分布式数据管理子系统的API变更如下: ## 接口变更 | 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | |---|---|---|---| | ohos.data.preferences | preferences | const MAX_VALUE_LENGTH: 8192; | 新增 | | ohos.data.preferences | preferences | const MAX_KEY_LENGTH: 80; | 新增 | | ohos.data.preferences | Preferences | off(type: 'change', callback?: Callback<{ key: string }>): void; | 新增 | | ohos.data.preferences | Preferences | on(type: 'change', callback: Callback<{ key: string }>): void; | 新增 | | ohos.data.preferences | Preferences | flush(callback: AsyncCallback): void;
flush(): Promise; | 新增 | | ohos.data.preferences | Preferences | clear(callback: AsyncCallback): void;
clear(): Promise; | 新增 | | ohos.data.preferences | Preferences | delete(key: string, callback: AsyncCallback): void;
delete(key: string): Promise; | 新增 | | ohos.data.preferences | Preferences | put(key: string, value: ValueType, callback: AsyncCallback): void;
put(key: string, value: ValueType): Promise; | 新增 | | ohos.data.preferences | Preferences | has(key: string, callback: AsyncCallback): void;
has(key: string): Promise; | 新增 | | ohos.data.preferences | Preferences | getAll(callback: AsyncCallback): void;
getAll(): Promise; | 新增 | | ohos.data.preferences | Preferences | get(key: string, defValue: ValueType, callback: AsyncCallback): void;
get(key: string, defValue: ValueType): Promise; | 新增 | | ohos.data.preferences | preferences | function removePreferencesFromCache(context: Context, name: string, callback: AsyncCallback): void;
function removePreferencesFromCache(context: Context, name: string): Promise; | 新增 | | ohos.data.preferences | preferences | function deletePreferences(context: Context, name: string, callback: AsyncCallback): void;
function deletePreferences(context: Context, name: string): Promise; | 新增 | | ohos.data.preferences | preferences | function getPreferences(context: Context, name: string, callback: AsyncCallback): void;
function getPreferences(context: Context, name: string): Promise; | 新增 | | ohos.data.storage | storage | const MAX_VALUE_LENGTH: 8192; | 废弃 | | ohos.data.storage | storage | const MAX_KEY_LENGTH: 80; | 废弃 | | ohos.data.storage | StorageObserver | key: string; | 废弃 | | ohos.data.storage | Storage | off(type: 'change', callback: Callback): void; | 废弃 | | ohos.data.storage | Storage | on(type: 'change', callback: Callback): void; | 废弃 | | ohos.data.storage | Storage | flush(callback: AsyncCallback): void;
flush(): Promise; | 废弃 | | ohos.data.storage | Storage | flushSync(): void; | 废弃 | | ohos.data.storage | Storage | clear(callback: AsyncCallback): void;
clear(): Promise; | 废弃 | | ohos.data.storage | Storage | clearSync(): void; | 废弃 | | ohos.data.storage | Storage | delete(key: string, callback: AsyncCallback): void;
delete(key: string): Promise; | 废弃 | | ohos.data.storage | Storage | deleteSync(key: string): void; | 废弃 | | ohos.data.storage | Storage | put(key: string, value: ValueType, callback: AsyncCallback): void;
put(key: string, value: ValueType): Promise; | 废弃 | | ohos.data.storage | Storage | putSync(key: string, value: ValueType): void; | 废弃 | | ohos.data.storage | Storage | has(key: string, callback: AsyncCallback): boolean;
has(key: string): Promise; | 废弃 | | ohos.data.storage | Storage | hasSync(key: string): boolean; | 废弃 | | ohos.data.storage | Storage | get(key: string, defValue: ValueType, callback: AsyncCallback): void;
get(key: string, defValue: ValueType): Promise; | 废弃 | | ohos.data.storage | Storage | getSync(key: string, defValue: ValueType): ValueType; | 废弃 | | ohos.data.storage | storage | function removeStorageFromCache(path: string, callback: AsyncCallback): void;
function removeStorageFromCache(path: string): Promise; | 废弃 | | ohos.data.storage | storage | function removeStorageFromCacheSync(path: string): void; | 废弃 | | ohos.data.storage | storage | function deleteStorage(path: string, callback: AsyncCallback): void;
function deleteStorage(path: string): Promise; | 废弃 | | ohos.data.storage | storage | function deleteStorageSync(path: string): void; | 废弃 | | ohos.data.storage | storage | function getStorage(path: string, callback: AsyncCallback): void;
function getStorage(path: string): Promise; | 废弃 | | ohos.data.storage | storage | function getStorageSync(path: string): Storage; | 废弃 |