mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-10-07 06:03:30 +00:00
【增加】新增@ohos.arkui.StateManagement.d.ts接口文件
Signed-off-by: wangyanchao <wangyanchao16@huawei.com>
This commit is contained in:
parent
d464587749
commit
be5b435744
170
api/@ohos.arkui.StateManagement.d.ts
vendored
Normal file
170
api/@ohos.arkui.StateManagement.d.ts
vendored
Normal file
@ -0,0 +1,170 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @kit ArkUI
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function that returns default creator.
|
||||
*
|
||||
* @typedef { function } StorageDefaultCreator<T>
|
||||
* @returns { T } default creator
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
export declare type StorageDefaultCreator<T> = () => T;
|
||||
|
||||
/**
|
||||
* AppStorageV2 is for UI state of app-wide access, has same life cycle as the app,
|
||||
* and saves database content only in memory.
|
||||
*
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
export declare class AppStorageV2 {
|
||||
/**
|
||||
* If the value for the given key is already available, return the value.
|
||||
* If not, add the key with value generated by calling defaultFunc and return it to caller.
|
||||
*
|
||||
* @param { string } key key adding
|
||||
* @param { StorageDefaultCreator<T> } [defaultCreator] the function generating the default value
|
||||
* @returns { T | undefined } the value of the existed key or the default value
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
static connect<T extends object>(key: string, defaultCreator?: StorageDefaultCreator<T>): T | undefined;
|
||||
|
||||
/**
|
||||
* Removes the given key. Return false if the given key does not exist.
|
||||
*
|
||||
* @param { string } key key removing
|
||||
* @returns { boolean } exist or not
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
static remove(key: string): boolean;
|
||||
|
||||
/**
|
||||
* Return the array of all keys.
|
||||
*
|
||||
* @returns { Array<string> } the array of all keys
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
static keys() : Array<string>
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that returns reason type when error.
|
||||
*
|
||||
* @typedef { function } PersistenceErrorCallback
|
||||
* @param { string } key persisted key when error
|
||||
* @param { "quota" | "serialization" | "unknown" } reason reason type when error
|
||||
* @param { string } message more message when error
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
export declare type PersistenceErrorCallback = (key: string, reason: "quota" | "serialization" | "unknown", message: string) => void;
|
||||
|
||||
/**
|
||||
* PersistenceV2 is for UI state of app-wide access, available on app re-start,
|
||||
* and saves database content in disk.
|
||||
*
|
||||
* @extends AppStorageV2
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
export declare class PersistenceV2 extends AppStorageV2 {
|
||||
/**
|
||||
* The purpose of the save function is request to persist non-observed object changes.
|
||||
*
|
||||
* @param { string } key key need to save, that persist non-observed object changes
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
static save(key: string): void;
|
||||
|
||||
/**
|
||||
* Be called when persisting has encountered an error.
|
||||
*
|
||||
* @param { PersistenceErrorCallback | undefined } callback called when error
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
static notifyOnError(callback: PersistenceErrorCallback | undefined): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define TypeConstructor type.
|
||||
*
|
||||
* @interface TypeConstructor<T>
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
export interface TypeConstructor<T> {
|
||||
/**
|
||||
* @returns { T }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
new(): T;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that returns PropertyDecorator.
|
||||
*
|
||||
* @typedef { function } TypeDecorator
|
||||
* @param { TypeConstructor<T> } type type info
|
||||
* @returns { PropertyDecorator } Type decorator
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
export declare type TypeDecorator = <T>(type: TypeConstructor<T>) => PropertyDecorator;
|
||||
|
||||
/**
|
||||
* Define Type PropertyDecorator, adds type information to an object.
|
||||
*
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
export declare const Type: TypeDecorator;
|
4
kits/@kit.ArkUI.d.ts
vendored
4
kits/@kit.ArkUI.d.ts
vendored
@ -114,6 +114,7 @@ import {
|
||||
PresetSplitRatio,
|
||||
FoldSplitContainer,
|
||||
} from '@ohos.arkui.advanced.FoldSplitContainer';
|
||||
import { AppStorageV2, PersistenceV2, Type } from '@ohos.arkui.StateManagement';
|
||||
|
||||
export {
|
||||
AddFormMenuItem, AddFormOptions, AlertDialog, Animator, AnimatorOptions, AnimatorResult, App, AppResponse, AtomicServiceBar,
|
||||
@ -142,5 +143,6 @@ export {
|
||||
screen, screenshot, uiAppearance, uiExtensionHost, uiObserver, window, windowAnimationManager, CustomContentDialog,
|
||||
IconOptions, ChipItemLabelOptions, ChipGroupItemOptions, ChipItemStyle, ChipGroupSpaceOptions, IconItemOptions, IconGroupSuffix, ChipGroup,
|
||||
SymbolGlyphModifier, Colors, CustomColors, Theme, ThemeControl, CustomTheme, ChipSymbolGlyphOptions,
|
||||
ExtraRegionPosition, ExpandedRegionLayoutOptions, SemiFoldedRegionLayoutOptions, FoldedRegionLayoutOptions, PresetSplitRatio, FoldSplitContainer
|
||||
ExtraRegionPosition, ExpandedRegionLayoutOptions, SemiFoldedRegionLayoutOptions, FoldedRegionLayoutOptions, PresetSplitRatio, FoldSplitContainer,
|
||||
AppStorageV2, PersistenceV2, Type
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user