mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2025-02-27 12:37:27 +00:00
remind localstorage in ts Signed-off-by: houhaoyu <houhaoyu@huawei.com> Change-Id: I37b174523a38d7f46cd7e9528a1500e4e1cdacaf
This commit is contained in:
parent
8c3453a8a4
commit
eef387f185
101
api/@internal/component/ets/common_ts_ets_api.d.ts
vendored
101
api/@internal/component/ets/common_ts_ets_api.d.ts
vendored
@ -498,4 +498,103 @@ declare class PersistentStorage {
|
|||||||
* @systemapi
|
* @systemapi
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
declare const appStorage: AppStorage;
|
declare const appStorage: AppStorage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define LocalStorage.
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
declare class LocalStorage {
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
constructor(initializingProperties?: Object);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get current LocalStorage shared from stage.
|
||||||
|
* @StageModelOnly
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
static GetShared(): LocalStorage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if prooperty with given name exists
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
has(propName: string): boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a Map Iterator
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
keys(): IterableIterator<string>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return number of properties
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
size(): number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return value of given property
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
get<T>(propName: string): T;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set value of given property
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
set<T>(propName: string, newValue: T): boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add property if not property with given name
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
setOrCreate<T>(propName: string, newValue?: T): boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create and return a 'link' (two-way sync) to named property
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
link<T>(propName: string, linkUser?: T, subscribersName?: string): T;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Like link(), will create and initialize a new source property in LocalStorge if missing
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
setAndLink<T>(propName: string, defaultValue: T, linkUser?: T, subscribersName?: string): T;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create and return a 'prop' (one-way sync) to named property
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
prop<T>(propName: string, propUser?: T, subscribersName?: string): T;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Like prop(), will create and initialize a new source property in LocalStorage if missing
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
setAndProp<T>(propName: string, defaultValue: T, propUser?: T, subscribersName?: string): T;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete property from StorageBase
|
||||||
|
* @since 9
|
||||||
|
* @returns false if method failed
|
||||||
|
*/
|
||||||
|
delete(propName: string): boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete all properties from the StorageBase
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
clear(): boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "StateManagement" {
|
||||||
|
module "StateManagement" {
|
||||||
|
// @ts-ignore
|
||||||
|
export { LocalStorage };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
100
api/@internal/component/ets/state_management.d.ts
vendored
100
api/@internal/component/ets/state_management.d.ts
vendored
@ -101,103 +101,3 @@ declare class Storage {
|
|||||||
*/
|
*/
|
||||||
delete(key: string): void;
|
delete(key: string): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Defining LocalStorage.
|
|
||||||
* @since 9
|
|
||||||
*/
|
|
||||||
declare class LocalStorage {
|
|
||||||
/**
|
|
||||||
* constructor.
|
|
||||||
* @since 9
|
|
||||||
*/
|
|
||||||
constructor(initializingProperties?: Object);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get current LocalStorage shared from stage.
|
|
||||||
* @StageModelOnly
|
|
||||||
* @since 9
|
|
||||||
*/
|
|
||||||
static GetShared(): LocalStorage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* return true if prooperty with given name exists
|
|
||||||
* @since 9
|
|
||||||
*/
|
|
||||||
has(propName: string): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* return a Map Iterator
|
|
||||||
* @since 9
|
|
||||||
*/
|
|
||||||
keys(): IterableIterator<string>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* return number of properties
|
|
||||||
* @since 9
|
|
||||||
*/
|
|
||||||
size(): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns value of given property
|
|
||||||
* @since 9
|
|
||||||
*/
|
|
||||||
get<T>(propName: string): T;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set value of given property
|
|
||||||
* @since 9
|
|
||||||
*/
|
|
||||||
set<T>(propName: string, newValue: T): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* add property if not property with given name
|
|
||||||
* @since 9
|
|
||||||
*/
|
|
||||||
setOrCreate<T>(propName: string, newValue?: T): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* create and return a 'link' (two-way sync) to named property
|
|
||||||
* @since 9
|
|
||||||
*/
|
|
||||||
link<T>(propName: string, linkUser?: T, subscribersName?: string): T;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Like link(), will create and initialize a new source property in LocalStorge if missing
|
|
||||||
* @since 9
|
|
||||||
*/
|
|
||||||
setAndLink<T>(propName: string, defaultValue: T, linkUser?: T, subscribersName?: string): T;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* create and return a 'prop' (one-way sync) to named property
|
|
||||||
* @since 9
|
|
||||||
*/
|
|
||||||
prop<T>(propName: string, propUser?: T, subscribersName?: string): T;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Like prop(), will create and initialize a new source property in LocalStorage if missing
|
|
||||||
* @since 9
|
|
||||||
*/
|
|
||||||
setAndProp<T>(propName: string, defaultValue: T, propUser?: T, subscribersName?: string): T;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete property from StorageBase
|
|
||||||
* @since 9
|
|
||||||
* @returns false if method failed
|
|
||||||
*/
|
|
||||||
delete(propName: string): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* delete all properties from the StorageBase
|
|
||||||
* @since 9
|
|
||||||
*/
|
|
||||||
clear(): boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "StateManagement" {
|
|
||||||
module "StateManagement" {
|
|
||||||
// @ts-ignore
|
|
||||||
export { LocalStorage };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user