diff --git a/api/@internal/component/ets/web.d.ts b/api/@internal/component/ets/web.d.ts index 6dee9d2ab01affa0414027cd228d6c1e896753b8..1f29edd85b2cf9834667ac162f16520f7f511292 100644 --- a/api/@internal/component/ets/web.d.ts +++ b/api/@internal/component/ets/web.d.ts @@ -14,7 +14,7 @@ */ declare type WebviewController = import('../api/@ohos.web.webview').default.WebviewController; - +import image from '../api/@ohos.multimedia.image'; /** * Enum type supplied to {@link getMessageLevel} for receiving the console log level of JavaScript. * @since 8 @@ -159,6 +159,107 @@ declare enum CacheMode { Only, } +/** + * The Web's scrollbar name. + * @since 9 + */ + declare enum ScrollBarType { + /** + * Horizontal scrollbar. + * @since 9 + */ + Horizontal, + + /** + * Vertical scrollbar. + * @since 9 + */ + Vertical, +} + + +/** +* Defines the context menue media type, related to {@link onContextMenuShow} method. +* @since 9 +*/ +declare enum ContextMenuMediaType { + /** + * Unknown type. + * @since 9 + */ + Unknown, + + /** + * Thel image type. + * @since 9 + */ + Image, +} + +/** +* Defines the context menue source type, related to {@link onContextMenuShow} method. +* @since 9 +*/ +declare enum ContextMenuSourceType { + /** + * Unknown type. + * @since 9 + */ + Unknown, + + /** + * The touch type. + * @since 9 + */ + Touch, + + /** + * The mouse type. + * @since 9 + */ + Mouse, +} + +/** +* Defines the context menue input field type, related to {@link onContextMenuShow} method. +* @since 9 +*/ +declare enum ContextMenuInputFieldType { + /** + * Unknown type. + * @since 9 + */ + Unknown, + /** + * The plainText type. + * @since 9 + */ + PlainText, + /** + * The password type. + * @since 9 + */ + Password, + /** + * The number type. + * @since 9 + */ + Number, +} + +/** +* Defines the context menue supported event bit flags, related to {@link onContextMenuShow} method. +* @since 9 +*/ +declare enum ContextMenuEditStatusFlags { + NONE = 0, + CAN_CUT = 1 << 1, + CAN_COPY = 1 << 2, + CAN_PASTE = 1 << 3, + CAN_DELETE = 1 << 4, + CAN_SELECT_ALL = 1 << 5, +} + /** * Define the handler to exit the full screen mode, related to the {@link onFullScreenEnter} event. * @since 9 @@ -534,7 +635,7 @@ declare class HttpAuthHandler { * @since 9 */ cancel(): void; - + /** * Ignore this certificate request temporarily. * @since 9 @@ -590,6 +691,30 @@ declare class PermissionRequest { grant(resources: Array): void; } +/** + * Defines the onDataResubmission callback, related to {@link onDataResubmission} method. + * @since 9 + */ +declare class DataResubmissionHandler { + /** + * Constructor. + * @since 9 + */ + constructor(); + + /** + * Resend related form data. + * @since 9 + */ + resend(): void; + + /** + * Do not resend related form data. + * @since 9 + */ + cancel(): void; +} + /** * Defines the onWindowNew callback, related to {@link onWindowNew} method. * @since 9 @@ -666,6 +791,43 @@ declare class WebContextMenuParam { * @since 9 */ existsImageContents(): boolean; + + /** + * Returns the type of context node. + * @since 9 + */ + getMediaType(): ContextMenuMediaType; + + /** + * Returns the text of the selection. + * @since 9 + */ + getSelectionText(): string; + + /** + * Returns the context menu source type. + * @since 9 + */ + getSourceType(): ContextMenuSourceType; + + /** + * Returns input field type if the context menu was invoked on an input field. + * @since 9 + */ + getInputFieldType(): ContextMenuInputFieldType; + + /** + * Return whether this context menu was invoked on an editable node. + * @since 9 + */ + isEditable(): boolean; + + /** + * Returns the edit status flags. + * + * @since 9 + */ + getEditStatusFlags(): number; } /** @@ -694,6 +856,41 @@ declare class WebContextMenuResult { * @since 9 */ copyImage(): void; + + /** + * Executes the copy operation ralated to this context menu. + * + * @since 9 + */ + copy(): void; + + /** + * Executes the paste operation ralated to this context menu. + * + * @since 9 + */ + paste(): void; + + /** + * Executes the delete operation ralated to this context menu. + * + * @since 9 + */ + delete(): void; + + /** + * Executes the selectAll operation ralated to this context menu. + * + * @since 9 + */ + selectAll(): void; + + /** + * Executes the cut operation ralated to this context menu. + * + * @since 9 + */ + cut(): void; } /** @@ -808,6 +1005,13 @@ declare class WebResourceRequest { * @since 8 */ isRedirect(): boolean; + + /** + * + * + * @since 9 + */ + getRequestMethod(): string; } @@ -1418,6 +1622,26 @@ declare interface WebOptions { controller: WebController | WebviewController; } +/** + * Defines the WebView media options. + * @since 10 + */ +declare interface WebMediaOption { + /** + * Set the audio re-focusing renewal period, in seconds. + * The default value is 0 seconds. + * @since 10 + */ + resumeInterval?: number; + + /** + * Set whether the audio is exclusive + * The default value is true. + * @since 10 + */ + audioExclusive?: boolean; +} + /** * Defines the Web interface. * @since 8 @@ -1921,6 +2145,160 @@ declare class WebAttribute extends CommonMethod { * @since 9 */ multiWindowAccess(multiWindow: boolean): WebAttribute; + + /** + * Notify the application key events are not consumed by the WebView. + * @param event Key event info. + * + * @since 9 + */ + onUnconsumedKeyEvent(callback: (event: KeyEvent) => void): WebAttribute; + + /** + * Key events notify the application before the WebView consumes them. + * @param event Key event info. + * + * @return True if the application consumes key events else false. + * @since 9 + */ + onPreKeyEvent(callback: (event: KeyEvent) => boolean): WebAttribute; + + /** + * WebView media options. + * @param options media options. + * + * @since 10 + */ + mediaOption(options: WebMediaOption): WebAttribute; + + /** + * Set the font of webview standard font library. The default font is "sans serif". + * @param family Standard font set series. + * + * @since 9 + */ + webStandardFont(family: string): WebAttribute; + + /** + * Set the font of webview serif font library. The default font is "serif". + * @param family Serif font set series. + * + * @since 9 + */ + webSerifFont(family: string): WebAttribute; + + /** + * Set the font of webview sans serif font library. The default font is "sans-serif". + * @param family Sans serif font set series. + * + * @since 9 + */ + webSansSerifFont(family: string): WebAttribute; + + /** + * Set the font of webview fixed font library. The default font is "monospace". + * @param family Fixed font set series. + * + * @since 9 + */ + webFixedfFont(family: string): WebAttribute; + + /** + * Set the font of webview fantasy font library. The default font is "fantasy". + * @param family fantasy font set series. + * + * @since 9 + */ + webFantasyFont(family: string): WebAttribute; + + /** + * Set the font of webview cursive font library. The default font is "cursive". + * @param family Cursive font set series. + * + * @since 9 + */ + webCursiveFont(family: string): WebAttribute; + + /** + * Set the default fixed font value of webview. The default value is 13, ranging from 1 to 72. + * @param size Font size. + * + * @since 9 + */ + defaultFixedFontSize(size: number): WebAttribute; + + /** + * Set the default font value of webview. The default value is 16, ranging from 1 to 72. + * @param size Font size. + * + * @since 9 + */ + defaultFontSize(size: number): WebAttribute; + + /** + * Set the minimum value of webview font. The default value is 8, and the values are 1 to 72. + * @param size Font size. + * + * @since 9 + */ + minFontSize(size: number): WebAttribute; + + /** + * Set whether to enable scroll bar. + * @param type The direction scroll bar to set. + * @param scrollBarAccess Ture if enable the scroll bar in the specified direction. + * + * @since 9 + */ + scrollBarAccess(type: ScrollBarType, scrollBarAccess: boolean): WebAttribute; + + /** + * Whether web component can load resource from network. + * @param block {@code true} means it can't load resource from network; {@code false} otherwise. + * + * @since 9 + */ + blockNetwork(block: boolean): WebAttribute; + + /** + * Whether use algorithmic darkening when the theme is dark mode. + * @param accept {@code true} means enable algorithmic darkening; {@code false} otherwise. + * + * @since 10 + */ + forceDarkAccess(accept: boolean): WebAttribute; + + /** + * Triggered when the application receive the url of an apple-touch-icon. + * @param callback The triggered callback when the application receive an new url of an + * apple-touch-icon. + * @since 9 + */ + onTouchIconUrlReceive(callback: (event: {url: string, + precomposed: boolean}) => void): WebAttribute; + + /** + * Triggered when the application receive a new favicon for the current web page. + * @param callback The triggered callback when the application receive a new favicon for the + * current web page. + * @since 9 + */ + onFaviconReceive(callback: (event: {favicon: image.PixelMap}) => void): WebAttribute; + + /** + * Triggered when previous page will no longer be drawn and next page begin to draw. + * @param callback The triggered callback when previous page will no longer be drawn and next + * page begin to draw. + * @since 9 + */ + onPageVisible(callback: (event: {url: string}) => void): WebAttribute; + + /** + * Trigger when the form could be resubmitted. + * @param callback The triggered callback to decision whether resend form data or not. + * @since 9 + */ + onDataResubmission(callback: (event: {handler: DataResubmissionHandler}) => void): WebAttribute; } declare const Web: WebInterface; diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index 7c303b80c7719a3e95c59e5ecef09720200b7c16..e21dc7b043f7a966e43727284d01302769614799 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -1289,7 +1289,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#put */ put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback): void; - put(key: string, value: Uint8Array | string | number | boolean): Promise; /** @@ -1306,7 +1305,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#delete */ delete(key: string, callback: AsyncCallback): void; - delete(key: string): Promise; /** @@ -1352,6 +1350,20 @@ declare namespace distributedData { */ off(event: 'dataChange', listener?: Callback): void; + /** + * UnRegister the {@code KvStore} database synchronization callback. + * + * @param syncCallback Indicates the callback used to send the synchronization result to caller. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#off + */ + off(event: 'syncComplete', syncCallback?: Callback>): void; + /** * Inserts key-value pairs into the {@code KvStore} database in batches. * @@ -1363,7 +1375,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#putBatch */ putBatch(entries: Entry[], callback: AsyncCallback): void; - putBatch(entries: Entry[]): Promise; /** @@ -1377,7 +1388,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#deleteBatch */ deleteBatch(keys: string[], callback: AsyncCallback): void; - deleteBatch(keys: string[]): Promise; /** @@ -1392,7 +1402,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#startTransaction */ startTransaction(callback: AsyncCallback): void; - startTransaction(): Promise; /** @@ -1406,7 +1415,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#commit */ commit(callback: AsyncCallback): void; - commit(): Promise; /** @@ -1419,7 +1427,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#rollback */ rollback(callback: AsyncCallback): void; - rollback(): Promise; /** @@ -1434,7 +1441,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#enableSync */ enableSync(enabled: boolean, callback: AsyncCallback): void; - enableSync(enabled: boolean): Promise; /** @@ -1451,7 +1457,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#setSyncRange */ setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback): void; - setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise; } @@ -1484,7 +1489,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#get */ get(key: string, callback: AsyncCallback): void; - get(key: string): Promise; /** @@ -1500,7 +1504,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#getEntries */ getEntries(keyPrefix: string, callback: AsyncCallback): void; - getEntries(keyPrefix: string): Promise; /** @@ -1516,7 +1519,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#getEntries */ getEntries(query: Query, callback: AsyncCallback): void; - getEntries(query: Query): Promise; /** @@ -1535,7 +1537,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#getResultSet */ getResultSet(keyPrefix: string, callback: AsyncCallback): void; - getResultSet(keyPrefix: string): Promise; /** @@ -1550,7 +1551,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#getResultSet */ getResultSet(query: Query, callback: AsyncCallback): void; - getResultSet(query: Query): Promise; /** @@ -1565,7 +1565,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#closeResultSet */ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; - closeResultSet(resultSet: KvStoreResultSet): Promise; /** @@ -1581,7 +1580,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#getResultSize */ getResultSize(query: Query, callback: AsyncCallback): void; - getResultSize(query: Query): Promise; /** @@ -1593,7 +1591,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#removeDeviceData */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; - removeDeviceData(deviceId: string): Promise; /** @@ -1613,6 +1610,21 @@ declare namespace distributedData { */ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; + /** + * Register a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback + * in the {@code KvStoreObserver} will be invoked. + * + * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param listener Indicates the observer of data change events in the distributed database. + * @throws Throws this exception if no {@code SingleKvStore} database is available. + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#on + */ + on(event: 'dataChange', type: SubscribeType, listener: Callback): void; + /** * Register a SingleKvStore database synchronization callback. *

Sync result is returned through asynchronous callback. @@ -1626,6 +1638,20 @@ declare namespace distributedData { */ on(event: 'syncComplete', syncCallback: Callback>): void; + /** + * Unsubscribe the SingleKvStore database based on the specified subscribeType and {@code KvStoreObserver}. + * + * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#off + */ + off(event: 'dataChange', listener?: Callback): void; + /** * UnRegister the SingleKvStore database synchronization callback. * @@ -1649,7 +1675,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#setSyncParam */ setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; - setSyncParam(defaultAllowedDelayMs: number): Promise; /** @@ -1664,7 +1689,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#getSecurityLevel */ getSecurityLevel(callback: AsyncCallback): void; - getSecurityLevel(): Promise; } @@ -1696,7 +1720,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#get */ get(deviceId: string, key: string, callback: AsyncCallback): void; - get(deviceId: string, key: string): Promise; /** @@ -1713,7 +1736,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getEntries */ getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; - getEntries(deviceId: string, keyPrefix: string): Promise; /** @@ -1729,7 +1751,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getEntries */ getEntries(query: Query, callback: AsyncCallback): void; - getEntries(query: Query): Promise; /** @@ -1744,7 +1765,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getEntries */ getEntries(deviceId: string, query: Query, callback: AsyncCallback): void; - getEntries(deviceId: string, query: Query): Promise; /** @@ -1766,7 +1786,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSet */ getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; - getResultSet(deviceId: string, keyPrefix: string): Promise; /** @@ -1782,7 +1801,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSet */ getResultSet(query: Query, callback: AsyncCallback): void; - getResultSet(query: Query): Promise; /** @@ -1797,7 +1815,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSet */ getResultSet(deviceId: string, query: Query, callback: AsyncCallback): void; - getResultSet(deviceId: string, query: Query): Promise; /** @@ -1812,7 +1829,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#closeResultSet */ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; - closeResultSet(resultSet: KvStoreResultSet): Promise; /** @@ -1828,7 +1844,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSize */ getResultSize(query: Query, callback: AsyncCallback): void; - getResultSize(query: Query): Promise; /** @@ -1843,7 +1858,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSize */ getResultSize(deviceId: string, query: Query, callback: AsyncCallback): void; - getResultSize(deviceId: string, query: Query): Promise; /** @@ -1860,7 +1874,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#removeDeviceData */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; - removeDeviceData(deviceId: string): Promise; /** @@ -1882,6 +1895,23 @@ declare namespace distributedData { */ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; + /** + * Register a {@code KvStoreObserver} for the database. When data in the distributed database changes, the + * callback in the {@code KvStoreObserver} will be invoked. + * + * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param listener Indicates the observer of data change events in the distributed database. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#on + */ + on(event: 'dataChange', type: SubscribeType, listener: Callback): void; + + /** * Register a DeviceKVStore database synchronization callback. * @@ -1896,6 +1926,20 @@ declare namespace distributedData { */ on(event: 'syncComplete', syncCallback: Callback>): void; + /** + * Unsubscribe the DeviceKVStore database based on the specified subscribeType and {@code KvStoreObserver}. + * + * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#off + */ + off(event: 'dataChange', listener?: Callback): void; + /** * UnRegister the DeviceKVStore database synchronization callback. * @@ -1951,7 +1995,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.KVManager#getKVStore */ getKVStore(storeId: string, options: Options): Promise; - getKVStore(storeId: string, options: Options, callback: AsyncCallback): void; /** @@ -1976,7 +2019,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.KVManager#closeKVStore */ closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCallback): void; - closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise; /** @@ -1998,7 +2040,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.KVManager#deleteKVStore */ deleteKVStore(appId: string, storeId: string, callback: AsyncCallback): void; - deleteKVStore(appId: string, storeId: string): Promise; /** @@ -2015,7 +2056,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.KVManager#getAllKVStoreId */ getAllKVStoreId(appId: string, callback: AsyncCallback): void; - getAllKVStoreId(appId: string): Promise; /** diff --git a/api/@ohos.data.distributedKVStore.d.ts b/api/@ohos.data.distributedKVStore.d.ts index 2ee6c9b9e551f3325c0e59887a1d95f6829ad9a8..9f076e0da9d1a3c42993b702467080da89f41167 100644 --- a/api/@ohos.data.distributedKVStore.d.ts +++ b/api/@ohos.data.distributedKVStore.d.ts @@ -163,6 +163,7 @@ declare namespace distributedKVStore { * @since 9 */ type: ValueType; + /** * Indicates the value * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -184,6 +185,7 @@ declare namespace distributedKVStore { * @since 9 */ key: string; + /** * Indicates the value * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -209,18 +211,21 @@ declare namespace distributedKVStore { * @since 9 */ insertEntries: Entry[]; + /** * Indicates data update records. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ updateEntries: Entry[]; + /** * Indicates data deletion records. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ deleteEntries: Entry[]; + /** * Indicates the device id which brings the data change. * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -242,12 +247,14 @@ declare namespace distributedKVStore { * @since 9 */ PULL_ONLY, + /** * Indicates that data is only pushed from the local end. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ PUSH_ONLY, + /** * Indicates that data is pushed from the local end, and then pulled from the remote end. * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -364,18 +371,21 @@ declare namespace distributedKVStore { * @since 9 */ createIfMissing?: boolean; + /** * Indicates whether database files to be encrypted * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ encrypt?: boolean; + /** * Indicates whether to back up database files * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ backup?: boolean; + /** * Indicates whether database files are automatically synchronized * @permission ohos.permission.DISTRIBUTED_DATASYNC @@ -383,18 +393,21 @@ declare namespace distributedKVStore { * @since 9 */ autoSync?: boolean; + /** * Indicates the database type * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ kvStoreType?: KVStoreType; + /** * Indicates the database security level * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ securityLevel: SecurityLevel; + /** * Indicates the database schema * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -427,6 +440,7 @@ declare namespace distributedKVStore { * @since 9 */ root: FieldNode; + /** * Indicates the string array of json. * @@ -434,6 +448,7 @@ declare namespace distributedKVStore { * @since 9 */ indexes: Array; + /** * Indicates the mode of schema. * @@ -441,6 +456,7 @@ declare namespace distributedKVStore { * @since 9 */ mode: number; + /** * Indicates the skip size of schema. * @@ -493,6 +509,7 @@ declare namespace distributedKVStore { * @since 9 */ default: string; + /** * Indicates the nullable of database field. * @@ -500,6 +517,7 @@ declare namespace distributedKVStore { * @since 9 */ nullable: boolean; + /** * Indicates the type of value. * @@ -1003,7 +1021,7 @@ declare namespace distributedKVStore { * @param {AsyncCallback} callback - the callback of put. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1020,7 +1038,7 @@ declare namespace distributedKVStore { * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1033,7 +1051,7 @@ declare namespace distributedKVStore { * @param {AsyncCallback} callback - the callback of putBatch. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1046,7 +1064,7 @@ declare namespace distributedKVStore { * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1059,7 +1077,7 @@ declare namespace distributedKVStore { * @param {AsyncCallback} callback - the callback of putBatch. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @systemapi * @since 9 @@ -1073,7 +1091,7 @@ declare namespace distributedKVStore { * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @systemapi * @since 9 @@ -1088,8 +1106,7 @@ declare namespace distributedKVStore { * @param {AsyncCallback} callback - the callback of delete. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the data not exist when delete data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1103,8 +1120,7 @@ declare namespace distributedKVStore { * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the data not exist when delete data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1117,8 +1133,7 @@ declare namespace distributedKVStore { * @param {AsyncCallback} callback - the callback of delete. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the data not exist when delete data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @since 9 @@ -1132,8 +1147,7 @@ declare namespace distributedKVStore { * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the data not exist when delete data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @since 9 @@ -1147,8 +1161,7 @@ declare namespace distributedKVStore { * @param {AsyncCallback} callback - the callback of deleteBatch. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the data not exist when delete data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1161,8 +1174,7 @@ declare namespace distributedKVStore { * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the data not exist when delete data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1176,7 +1188,7 @@ declare namespace distributedKVStore { * @param {string} deviceId - Identifies the device whose data is to be removed and the value cannot be the current device ID. * @param {AsyncCallback} callback - the callback of removeDeviceData. * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ @@ -1190,7 +1202,7 @@ declare namespace distributedKVStore { * @param {string} deviceId - Identifies the device whose data is to be removed and the value cannot be the current device ID. * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ @@ -1205,7 +1217,7 @@ declare namespace distributedKVStore { * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100004 - if the data not exist when query data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1220,7 +1232,7 @@ declare namespace distributedKVStore { * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100004 - if the data not exist when query data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1230,11 +1242,11 @@ declare namespace distributedKVStore { * Obtains all key-value pairs that match a specified key prefix. * * @param {string} keyPrefix - Indicates the key prefix to match. - \* @param {AsyncCallback} callback - {Entry[]}: the list of all key-value pairs + * @param {AsyncCallback} callback - {Entry[]}: the list of all key-value pairs * that match the specified key prefix. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1248,7 +1260,7 @@ declare namespace distributedKVStore { * specified key prefix. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1262,8 +1274,7 @@ declare namespace distributedKVStore { * matching the specified {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1277,8 +1288,7 @@ declare namespace distributedKVStore { * specified {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1296,7 +1306,7 @@ declare namespace distributedKVStore { * object matching the specified keyPrefix. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1314,7 +1324,7 @@ declare namespace distributedKVStore { * object matching the specified keyPrefix. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1328,7 +1338,7 @@ declare namespace distributedKVStore { * object matching the specified {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1342,7 +1352,7 @@ declare namespace distributedKVStore { * object matching the specified {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1356,7 +1366,7 @@ declare namespace distributedKVStore { * object matching the specified {@code dataSharePredicates.DataSharePredicates} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @since 9 @@ -1371,7 +1381,7 @@ declare namespace distributedKVStore { * object matching the specified {@code dataSharePredicates.DataSharePredicates} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @since 9 @@ -1408,7 +1418,7 @@ declare namespace distributedKVStore { * specified {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1422,7 +1432,7 @@ declare namespace distributedKVStore { * {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1434,8 +1444,7 @@ declare namespace distributedKVStore { * @param {string} file - Indicates the database backup filename. * @param {AsyncCallback} callback - the callback of backup. * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1447,8 +1456,7 @@ declare namespace distributedKVStore { * @param {string} file - Indicates the database backup filename. * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1460,8 +1468,7 @@ declare namespace distributedKVStore { * @param {string} file - Indicates the database backup filename. * @param {AsyncCallback} callback - the callback of restore. * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1473,8 +1480,7 @@ declare namespace distributedKVStore { * @param {string} file - Indicates the database backup filename. * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1511,7 +1517,7 @@ declare namespace distributedKVStore { *

After the database transaction is started, you can submit or roll back the operation. * * @param {AsyncCallback} callback - the callback of startTransaction. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1523,7 +1529,7 @@ declare namespace distributedKVStore { *

After the database transaction is started, you can submit or roll back the operation. * * @returns {Promise} the promise returned by the function. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1533,7 +1539,7 @@ declare namespace distributedKVStore { * Submits a transaction operation in the {@code SingleKVStore} database. * * @param {AsyncCallback} callback - the callback of commit. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1543,7 +1549,7 @@ declare namespace distributedKVStore { * Submits a transaction operation in the {@code SingleKVStore} database. * * @returns {Promise} the promise returned by the function. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1553,7 +1559,7 @@ declare namespace distributedKVStore { * Rolls back a transaction operation in the {@code SingleKVStore} database. * * @param {AsyncCallback} callback - the callback of rollback. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1563,7 +1569,7 @@ declare namespace distributedKVStore { * Rolls back a transaction operation in the {@code SingleKVStore} database. * * @returns {Promise} the promise returned by the function. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1689,7 +1695,7 @@ declare namespace distributedKVStore { * object indicates the data change events in the distributed database. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100001 - if the database has been subscribed over the max subscription time limit. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1714,7 +1720,7 @@ declare namespace distributedKVStore { * @param {Callback} listener - {ChangeNotification}: the {@code ChangeNotification} * object indicates the data change events in the distributed database. * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1737,7 +1743,7 @@ declare namespace distributedKVStore { * * @param {AsyncCallback} callback - {SecurityLevel}: the {@code SecurityLevel} * object indicates the security level of the database. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1748,7 +1754,7 @@ declare namespace distributedKVStore { * * @returns {Promise} {SecurityLevel}: the {@code SecurityLevel} object indicates * the security level of the database. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1768,7 +1774,37 @@ declare namespace distributedKVStore { */ interface DeviceKVStore extends SingleKVStore { /** - * Obtains the {@code String} value matching a specified device ID and key. + * Obtains the value matching the local device ID and specified key. + * + * @param {string} key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * @param {AsyncCallback} callback - + * {Uint8Array|string|boolean|number}: the returned value specified by the local device ID and specified key. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the data not exist when query data. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + get(key: string, callback: AsyncCallback): void; + + /** + * Obtains the value matching the local device ID and specified key. + * + * @param {string} key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * @returns {Promise} + * {Uint8Array|string|boolean|number}: the returned value specified by the local device ID and specified key. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the data not exist when query data. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + get(key: string): Promise; + + /** + * Obtains the value matching a specified device ID and key. * * @param {string} deviceId - Indicates the device to be queried. * @param {string} key - Indicates the key of the value to be queried. @@ -1778,14 +1814,14 @@ declare namespace distributedKVStore { * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100004 - if the data not exist when query data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ get(deviceId: string, key: string, callback: AsyncCallback): void; /** - * Obtains the {@code String} value matching a specified device ID and key. + * Obtains the value matching a specified device ID and key. * * @param {string} deviceId - Indicates the device to be queried. * @param {string} key - Indicates the key of the value to be queried. @@ -1795,12 +1831,40 @@ declare namespace distributedKVStore { * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100004 - if the data not exist when query data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ get(deviceId: string, key: string): Promise; + /** + * Obtains all key-value pairs that match the local device ID and specified key prefix. + * + * @param {string} keyPrefix - Indicates the key prefix to match. + * @param {AsyncCallback} callback - {Entry[]}: the list of all key-value pairs + * that match the local device ID and specified key prefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(keyPrefix: string, callback: AsyncCallback): void; + + /** + * Obtains all key-value pairs that match the local device ID and specified key prefix. + * + * @param {string} keyPrefix - Indicates the key prefix to match. + * @returns {Promise} {Entry[]}: the list of all key-value pairs that match the + * local device ID and specified key prefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(keyPrefix: string): Promise; + /** * Obtains all key-value pairs matching a specified device ID and key prefix. * @@ -1811,7 +1875,7 @@ declare namespace distributedKVStore { * @returns Returns the list of all key-value pairs meeting the given criteria. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ @@ -1827,12 +1891,40 @@ declare namespace distributedKVStore { * @returns Returns the list of all key-value pairs meeting the given criteria. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ getEntries(deviceId: string, keyPrefix: string): Promise; + /** + * Obtains the list of key-value pairs matching the local device ID and specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @param {AsyncCallback} callback - {Entry[]}: the list of all key-value pairs + * matching the local device ID and specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(query: Query, callback: AsyncCallback): void; + + /** + * Obtains the list of key-value pairs matching the local device ID and specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @returns {Promise} {Entry[]}: the list of all key-value pairs matching the local device ID and + * specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(query: Query): Promise; + /** * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object. * @@ -1842,8 +1934,7 @@ declare namespace distributedKVStore { * matching the specified deviceId and {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ @@ -1858,13 +1949,48 @@ declare namespace distributedKVStore { * specified deviceId and {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ getEntries(deviceId: string, query: Query): Promise; + /** + * Obtains the result set with the local device ID and specified prefix from a {@code SingleKVStore} database. + * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. + * Each {@code SingleKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. + * If you have created four objects, calling this method will return a failure. Therefore, you are advised to + * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. + * + * @param {string} keyPrefix - Indicates the key prefix to match. + * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified keyPrefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSet(keyPrefix: string, callback: AsyncCallback): void; + + /** + * Obtains the result set with the local device ID and specified prefix from a {@code SingleKVStore} database. + * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. + * Each {@code SingleKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. + * If you have created four objects, calling this method will return a failure. Therefore, you are advised to + * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. + * + * @param {string} keyPrefix - Indicates the key prefix to match. + * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified keyPrefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSet(keyPrefix: string): Promise; + /** * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix. * @@ -1879,7 +2005,7 @@ declare namespace distributedKVStore { * object matching the specified deviceId and keyPrefix. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ @@ -1899,12 +2025,40 @@ declare namespace distributedKVStore { * object matching the specified deviceId and keyPrefix. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ getResultSet(deviceId: string, keyPrefix: string): Promise; + /** + * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSet(query: Query, callback: AsyncCallback): void; + + /** + * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSet(query: Query): Promise; + /** * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object. * @@ -1914,7 +2068,7 @@ declare namespace distributedKVStore { * object matching the specified deviceId and {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ @@ -1929,12 +2083,42 @@ declare namespace distributedKVStore { * object matching the specified deviceId and {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ getResultSet(deviceId: string, query: Query): Promise; + /** + * Obtains the KVStoreResultSet object matching the local device ID and specified predicate object. + * + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates the datasharePredicates. + * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.DataShare.Provider + * @systemapi + * @since 9 + */ + getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; + + /** + * Obtains the KVStoreResultSet object matching the local device ID and specified predicate object. + * + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates the datasharePredicates. + * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.DataShare.Provider + * @systemapi + * @since 9 + */ + getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; + /** * Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object. * @@ -1944,7 +2128,7 @@ declare namespace distributedKVStore { * object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @since 9 @@ -1960,13 +2144,41 @@ declare namespace distributedKVStore { * object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @since 9 */ getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise; + /** + * Obtains the number of results matching the local device ID and specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @param {AsyncCallback} callback - {number}: the number of results matching the + * local device ID and specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSize(query: Query, callback: AsyncCallback): void; + + /** + * Obtains the number of results matching the local device ID and specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @returns {Promise} {number}: the number of results matching the local device ID and specified + * {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSize(query: Query): Promise; + /** * Obtains the number of results matching a specified device ID and {@code Query} object. * @@ -1976,7 +2188,7 @@ declare namespace distributedKVStore { * specified deviceId and {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ @@ -1991,7 +2203,7 @@ declare namespace distributedKVStore { * deviceId and {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ diff --git a/api/@ohos.multimodalInput.inputConsumer.d.ts b/api/@ohos.multimodalInput.inputConsumer.d.ts index b7e0d8f3c92b80bca3891291a1b74b142a76cd25..bd0666174c642d70d6c2636b8b83ad7b68e1b9e1 100644 --- a/api/@ohos.multimodalInput.inputConsumer.d.ts +++ b/api/@ohos.multimodalInput.inputConsumer.d.ts @@ -20,7 +20,6 @@ import { Callback } from './basic'; * * @since 8 * @syscap SystemCapability.MultimodalInput.Input.InputConsumer - * @import import inputConsumer from '@ohos.multimodalInput.inputConsumer'; * @systemapi hide for inner use */ diff --git a/api/@ohos.multimodalInput.inputDevice.d.ts b/api/@ohos.multimodalInput.inputDevice.d.ts index 2d3cc320917d95964c54880f9856073c5797dea4..01b85fda5a8a6d4d70235fba4a66fa4efa7641fc 100755 --- a/api/@ohos.multimodalInput.inputDevice.d.ts +++ b/api/@ohos.multimodalInput.inputDevice.d.ts @@ -21,7 +21,6 @@ import { KeyCode } from "./@ohos.multimodalInput.keyCode" * * @since 8 * @syscap SystemCapability.MultimodalInput.Input.InputDevice - * @import import inputDevice from '@ohos.multimodalInput.inputDevice'; */ declare namespace inputDevice { /** @@ -93,7 +92,7 @@ declare namespace inputDevice { * @since 9 * @syscap SystemCapability.MultimodalInput.Input.InputDevice * @param type Type of the input device event, which is **change**. - * @return Callback for the input device event. + * @returns Callback for the input device event. * @throws {BusinessError} 401 - Parameter error. */ function on(type: "change", listener: Callback): void; @@ -104,7 +103,7 @@ declare namespace inputDevice { * @since 9 * @syscap SystemCapability.MultimodalInput.Input.InputDevice * @param type Type of the input device event, which is **change**. - * @return Callback for the input device event. + * @returns Callback for the input device event. * @throws {BusinessError} 401 - Parameter error. */ function off(type: "change", listener?: Callback): void; @@ -318,10 +317,10 @@ declare namespace inputDevice { * @syscap SystemCapability.MultimodalInput.Input.InputDevice * @param deviceId ID of the input device. * @param keys Key codes of the input device, You can query a maximum of five key codes at a time. - * @return Returns a result indicating whether the specified key codes are supported. + * @returns Returns a result indicating whether the specified key codes are supported. * @throws {BusinessError} 401 - Parameter error. */ - function supportKeys(deviceId: number, keys: Array, callback: Callback>): void; + function supportKeys(deviceId: number, keys: Array, callback: AsyncCallback>): void; /** * Checks whether the specified key codes of an input device are supported. @@ -330,7 +329,7 @@ declare namespace inputDevice { * @syscap SystemCapability.MultimodalInput.Input.InputDevice * @param deviceId ID of the input device. * @param keys Key codes of the input device, You can query a maximum of five key codes at a time. - * @return Returns a result indicating whether the specified key codes are supported. + * @returns Returns a result indicating whether the specified key codes are supported. * @throws {BusinessError} 401 - Parameter error. */ function supportKeys(deviceId: number, keys: Array): Promise>; @@ -341,7 +340,7 @@ declare namespace inputDevice { * @since 9 * @syscap SystemCapability.MultimodalInput.Input.InputDevice * @param deviceId ID of the specified input device. - * @return Returns the keyboard type. + * @returns Returns the keyboard type. * @throws {BusinessError} 401 - Parameter error. */ function getKeyboardType(deviceId: number, callback: AsyncCallback): void; @@ -352,7 +351,7 @@ declare namespace inputDevice { * @since 9 * @syscap SystemCapability.MultimodalInput.Input.InputDevice * @param deviceId ID of the specified input device. - * @return Returns the keyboard type. + * @returns Returns the keyboard type. * @throws {BusinessError} 401 - Parameter error. */ function getKeyboardType(deviceId: number): Promise; diff --git a/api/@ohos.multimodalInput.inputEvent.d.ts b/api/@ohos.multimodalInput.inputEvent.d.ts index a335447db29e23e0e60934143082320bcdfd249d..79de5c419398158fb7f2eae3c7eb7ad8a6b8a141 100755 --- a/api/@ohos.multimodalInput.inputEvent.d.ts +++ b/api/@ohos.multimodalInput.inputEvent.d.ts @@ -18,7 +18,6 @@ * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import InputEvent from '@ohos.multimodalInput.inputEvent'; */ export declare interface InputEvent { /** diff --git a/api/@ohos.multimodalInput.inputEventClient.d.ts b/api/@ohos.multimodalInput.inputEventClient.d.ts index 589bb0c18c1763dc7f7431f43b9253bd81a8a9e4..39b5a5071799314c462ba3bf6dd5ce3794dd136d 100644 --- a/api/@ohos.multimodalInput.inputEventClient.d.ts +++ b/api/@ohos.multimodalInput.inputEventClient.d.ts @@ -18,7 +18,6 @@ * * @since 8 * @syscap SystemCapability.MultimodalInput.Input.InputSimulator - * @import import inputEventClient from '@ohos.multimodalInput.inputEventClient'; * @systemapi hide for inner use */ diff --git a/api/@ohos.multimodalInput.inputMonitor.d.ts b/api/@ohos.multimodalInput.inputMonitor.d.ts index f61123da732df33d02b6c81062f7a9321ac74d9f..3d16252a7195ccd152a1311e51acc39673bb7e5c 100644 --- a/api/@ohos.multimodalInput.inputMonitor.d.ts +++ b/api/@ohos.multimodalInput.inputMonitor.d.ts @@ -21,7 +21,6 @@ import { MouseEvent } from './@ohos.multimodalInput.mouseEvent'; * System API, available only to system processes * @since 7 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor - * @import import inputMonitor from '@ohos.multimodalInput.inputMonitor'; * @permission ohos.permission.INPUT_MONITORING * @systemapi hide for inner use */ @@ -63,7 +62,7 @@ declare namespace inputMonitor { function on(type:"mouse", receiver:Callback):void; /** - * Cancels listening for touch input events. + * Cancel listening for touch input events. * @since 7 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor * @systemapi hide for inner use @@ -76,7 +75,7 @@ declare namespace inputMonitor { function off(type:"touch", receiver?:TouchEventReceiver):void; /** - * Cancels listening for mouse input events. + * Cancel listening for mouse input events. * @since 9 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor * @systemapi hide for inner use diff --git a/api/@ohos.multimodalInput.keyCode.d.ts b/api/@ohos.multimodalInput.keyCode.d.ts index 7da279b403296627084bee2500c29478cabc7f5e..f25638ee7dbad56c203ac9c5055b30743a44cc0f 100644 --- a/api/@ohos.multimodalInput.keyCode.d.ts +++ b/api/@ohos.multimodalInput.keyCode.d.ts @@ -18,7 +18,6 @@ * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core -* @import import {KeyCode} from '@ohos.multimodalInput.keyCode', */ export declare enum KeyCode { diff --git a/api/@ohos.multimodalInput.keyEvent.d.ts b/api/@ohos.multimodalInput.keyEvent.d.ts index af0acb4ad4d6963d148e76cbddaa762aa6cd605a..d51cf1af5844da24df8581808ca999be6ea32910 100755 --- a/api/@ohos.multimodalInput.keyEvent.d.ts +++ b/api/@ohos.multimodalInput.keyEvent.d.ts @@ -19,7 +19,6 @@ import { KeyCode } from "./@ohos.multimodalInput.keyCode" * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core -* @import import {Action} from '@ohos.multimodalInput.keyEvent'; */ export declare enum Action { /** @@ -43,7 +42,6 @@ export declare enum Action { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core -* @import import {Key} from '@ohos.multimodalInput.keyEvent'; */ export declare interface Key { /** @@ -67,7 +65,6 @@ export declare interface Key { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core -* @import import {KeyEvent} from '@ohos.multimodalInput.keyEvent'; */ export declare interface KeyEvent extends InputEvent { /** diff --git a/api/@ohos.multimodalInput.mouseEvent.d.ts b/api/@ohos.multimodalInput.mouseEvent.d.ts index 8598db12bfaa6d4656a9f26699b8117173b60f4e..7828872e9c85c356649a6b6206f93a674d4df978 100755 --- a/api/@ohos.multimodalInput.mouseEvent.d.ts +++ b/api/@ohos.multimodalInput.mouseEvent.d.ts @@ -20,7 +20,6 @@ import { KeyCode } from "./@ohos.multimodalInput.keyCode" * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import {Action} from '@ohos.multimodalInput.mouseEvent'; */ export declare enum Action { /** @@ -64,7 +63,6 @@ export declare enum Action { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import {Button} from '@ohos.multimodalInput.mouseEvent'; */ export declare enum Button { /** @@ -113,7 +111,6 @@ export declare enum Button { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import {Axis} from '@ohos.multimodalInput.mouseEvent'; */ export declare enum Axis { /** @@ -137,7 +134,6 @@ export declare enum Axis { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import {AxisValue} from '@ohos.multimodalInput.mouseEvent'; */ export declare interface AxisValue { /** @@ -156,7 +152,6 @@ export declare interface AxisValue { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import {MouseEvent} from '@ohos.multimodalInput.mouseEvent'; */ export declare interface MouseEvent extends InputEvent { /** diff --git a/api/@ohos.multimodalInput.pointer.d.ts b/api/@ohos.multimodalInput.pointer.d.ts index 55fa1863b6d8688f50713e6f5fa12fcb75460dfc..195b6d098f006a2e0065e0e0eb66004ad532a6c9 100644 --- a/api/@ohos.multimodalInput.pointer.d.ts +++ b/api/@ohos.multimodalInput.pointer.d.ts @@ -20,7 +20,6 @@ import { AsyncCallback } from "./basic"; * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Pointer - * @import import pointer from '@ohos.multimodalInput.pointer'; */ declare namespace pointer { /** @@ -242,7 +241,7 @@ declare namespace pointer { * @syscap SystemCapability.MultimodalInput.Input.Pointer * @systemapi hide for inner use * @param speed Pointer moving speed. - * @return Returns the result through a promise. + * @returns Returns the result through a promise. * @throws {BusinessError} 401 - Parameter error. */ function setPointerSpeed(speed: number): Promise; @@ -262,7 +261,7 @@ declare namespace pointer { * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Pointer * @systemapi hide for inner use - * @return Returns the result through a promise. + * @returns Returns the result through a promise. */ function getPointerSpeed(): Promise; @@ -283,7 +282,7 @@ declare namespace pointer { * @syscap SystemCapability.MultimodalInput.Input.Pointer * @param windowId Window ID. * @param pointerStyle Pointer style. - * @return Returns the result through a promise. + * @returns Returns the result through a promise. * @throws {BusinessError} 401 - Parameter error. */ function setPointerStyle(windowId: number, pointerStyle: PointerStyle): Promise; @@ -303,7 +302,7 @@ declare namespace pointer { * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Pointer * @param windowId Window ID. - * @return Returns the result through a promise. + * @returns Returns the result through a promise. * @throws {BusinessError} 401 - Parameter error. */ function getPointerStyle(windowId: number): Promise; @@ -335,7 +334,7 @@ declare namespace pointer { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Pointer - * @return Returns true if the pointer icon is visible; returns false otherwise. + * @returns Returns true if the pointer icon is visible; returns false otherwise. * @throws {BusinessError} 401 - Parameter error. */ function isPointerVisible(callback: AsyncCallback): void; @@ -345,7 +344,7 @@ declare namespace pointer { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Pointer - * @return Returns true if the pointer icon is visible; returns false otherwise. + * @returns Returns true if the pointer icon is visible; returns false otherwise. */ function isPointerVisible(): Promise; } diff --git a/api/@ohos.multimodalInput.touchEvent.d.ts b/api/@ohos.multimodalInput.touchEvent.d.ts index bf637da06e2ba73c754b62249f8d1a6d907d3e5d..5748890333f8aa26d0e0bdc91c9adb6c52c8494c 100755 --- a/api/@ohos.multimodalInput.touchEvent.d.ts +++ b/api/@ohos.multimodalInput.touchEvent.d.ts @@ -19,7 +19,6 @@ import { InputEvent } from './@ohos.multimodalInput.inputEvent' * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import {Action} from '@ohos.multimodalInput.touchEvent'; */ export declare enum Action { /** @@ -48,7 +47,6 @@ export declare enum Action { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import {ToolType} from '@ohos.multimodalInput.touchEvent'; */ export declare enum ToolType { /** @@ -94,7 +92,6 @@ export declare enum ToolType { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import {SourceType} from '@ohos.multimodalInput.touchEvent'; */ export declare enum SourceType { /** @@ -118,7 +115,6 @@ export declare enum SourceType { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import {Touch} from '@ohos.multimodalInput.touchEvent'; */ export declare interface Touch { /** @@ -217,7 +213,6 @@ export declare interface Touch { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import {TouchEvent} from '@ohos.multimodalInput.touchEvent'; */ export declare interface TouchEvent extends InputEvent { /** diff --git a/api/@ohos.web.webview.d.ts b/api/@ohos.web.webview.d.ts index b678e138c4e7ccf6c16a728c0d4571ab66cff0a1..2c7e8f0ff57aec74a6bdbc536fd903bb4b1c6d15 100644 --- a/api/@ohos.web.webview.d.ts +++ b/api/@ohos.web.webview.d.ts @@ -17,6 +17,8 @@ import {AsyncCallback} from "./basic"; import {Resource} from 'GlobalResource'; +import image from "./@ohos.multimedia.image"; +import rpc from "./@ohos.rpc"; /** * This module provides the capability to manage web modules. @@ -230,6 +232,96 @@ declare namespace webview { static saveHttpAuthCredentials(host: string, realm: string, username: string, password: string): void; } + /** + * Provides information for history item in BackForwardList. + * @name HistoryItem + * @since 9 + * @syscap SystemCapability.Web.Webview.Core + */ + class HistoryItem { + /** + * Constructor. + * + * @since 9 + */ + constructor(); + + /** + * Get favicon of this history item. + * + * @returns { image.PixelMap } The favicon of this history item. + * @since 9 + */ + getIcon(): image.PixelMap; + + /** + * Get original url of this history item. + * + * @returns { string } The original url of this history item. + * @since 9 + */ + getHistoryRawUrl(): string; + + /** + * Get title of this history item. + * + * @returns { string } The title of this history item. + * @since 9 + */ + getHistoryTitle(): string; + + /** + * Get url of this history item. + * + * @returns { string } The url of this history item. + * @since 9 + */ + getHistoryUrl(): string; + } + + /** + * Provides back and forward history list information method. related to {@link HistoryItem}. + * @name BackForwardList + * @since 9 + * @syscap SystemCapability.Web.Webview.Core + */ + class BackForwardList { + /** + * Constructor. + * + * @since 9 + */ + constructor(); + + /** + * Get current index in BackForwardList + * + * @returns { HistoryItem } current index in BackForwardList. + * + * @since 9 + */ + getIndex(): number; + + /** + * Get size of in BackForwardList + * + * @returns { number } number of HistroyItem in list. + * @since 9 + */ + getSize(): number; + + /** + * Get history entry at given index. + * + * @param { number } index Index of back forward list entry. + * @throws { BusinessError } 401 - Invalid input parameter. + * @returns { HistoryItem } HistroyItem at given index in back forward list. + * + * @since 9 + */ + getItemAtIndex(index: number): HistoryItem; + } + /** * Provides asynchronous methods for manage the webview. * @@ -239,7 +331,7 @@ declare namespace webview { /** * Constructor. * - * @param { WebController } controller WebAsyncController needs a WebController + * @param { WebController } controller WebAsyncController needs a WebController * to associate with corresponding nweb. * * @since 9 @@ -395,7 +487,7 @@ declare namespace webview { /** * Set whether the instance should send and accept cookies. * By default this is set to be true. - * + * * @param { boolean } accept - Whether the instance should send and accept cookies. * @throws { BusinessError } 401 - Invalid input parameter. * @@ -415,7 +507,7 @@ declare namespace webview { /** * Set whether the instance should send and accept thirdparty cookies. * By default this is set to be false. - * + * * @param { boolean } accept - Whether the instance should send and accept thirdparty cookies. * @throws { BusinessError } 401 - Invalid input parameter. * @@ -447,6 +539,18 @@ declare namespace webview { static deleteSessionCookie(): void; } + /** + * Define the basic data types supported: string, number and boolean. + * @since 9 + */ + type MessageBaseType = string | number | boolean; + + /** + * Define the data types web message supported: ArrayBuffer, Array, MessageBaseType and Error. + * @since 9 + */ + type WebMessage = ArrayBuffer | Array | MessageBaseType | Error; + /** * Define html web message port. * @since 9 @@ -460,23 +564,48 @@ declare namespace webview { /** * Post a message to other port. - * @param { string } message - Message to send. + * @param { WebMessage } message - Message to send. * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100010 - Can not post message using this port. * * @since 9 */ - postMessageEvent(message: string): void; + postMessageEvent(message: WebMessage): void; /** * Receive message from other port. - * @param { (result: string) => void } callback - Callback function for receiving messages. + * @param { (result: WebMessage) => void } callback - Callback function for receiving messages. * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100006 - Can not register message event using this port. * * @since 9 */ - onMessageEvent(callback: (result: string) => void): void; + onMessageEvent(callback: (result: WebMessage) => void): void; + } + + /** + * SecureDnsMode determines whether to use httpdns to query dns, and whether to allow fallback + * to system dns when httpdns query fails. + * @since 10 + */ + declare enum SecureDnsMode { + /** + * Do not use httpdns. + * @since 10 + */ + Off, + + /** + * Prioritize using httpdns for query, if the query fails, it will fallback to the system dns. + * @since 10 + */ + Automatic, + + /** + * Only use httpdns to query dns. + * @since 10 + */ + Secure, } /** @@ -485,6 +614,27 @@ declare namespace webview { * @since 9 */ class WebviewController { + /** + * Initialize the web engine before loading the web components. + * + * @note This is a global static API that must be called on the UI thread, and it will have no effect if any + * web components are loaded. + * + * @since 9 + */ + static initializeWebEngine(): void; + + /** + * Sets debugging of web contents into any webviews of this application. + * + * @param { number } webDebuggingAccess - True if enables debugging of web contents into any webviews + * of this application otherwise false. + * @throws { BusinessError } 401 - Invalid input parameter. + * + * @since 9 + */ + static setWebDebuggingAccess(webDebuggingAccess: boolean): void; + /** * Checks whether the web page can go forward. * @@ -798,7 +948,7 @@ declare namespace webview { * Registers the JavaScript object and method list. * * @param { object } object - Application side JavaScript objects participating in registration. - * @param { string } name - The name of the registered object, which is consistent with the + * @param { string } name - The name of the registered object, which is consistent with the * object name called in the window. * @param { Array } methodList - Thr method of the application side JavaScript object participating * in the registration. @@ -882,19 +1032,19 @@ declare namespace webview { * Loads a piece of code and execute JS code in the context of the currently displayed page. * * @param { string } script - JavaScript Script. - * @param { AsyncCallback } callback - Callbacks execute JavaScript script results. + * @param { AsyncCallback } callback - Callbacks execute JavaScript script results. * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100001 - Init error. * The WebviewController must be associated with a Web component. - * @returns { Promise } A promise is solved after the JavaScript script is executed. + * @returns { Promise } A promise is solved after the JavaScript script is executed. * This parameter will be the result of JavaScript script execution. * If the JavaScript script fails to execute or has no return value, * null will be returned. * * @since 9 */ - runJavaScript(script: string): Promise; - runJavaScript(script: string, callback : AsyncCallback): void; + runJavaScript(script: string): Promise; + runJavaScript(script: string, callback : AsyncCallback): void; /** * Gets the url of current Web page. @@ -906,6 +1056,168 @@ declare namespace webview { * @since 9 */ getUrl(): string; + + /** + * Set whether to use httpdns for dns query. + * @param secDnsMode {@link SecureDnsMode} Whether to use httpdns and whether to allow fallback to system dns. + * @param secDnsServer The httpdns server. + * + * @since 10 + */ + static setHttpDns(secDnsMode:SecureDnsMode, secDnsServer:string): WebAttribute; + + /** + * Set the scrolled position of the webview. + * + * @param { number } x - The horizontal coordinate of the scrolled position. + * @param { number } y - The vertical coordinate of the scrolled position. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 17100001 - Init error. + * The WebviewController must be associated with a Web component. + * + * @since 9 + */ + scrollTo(x: number, y:number): void; + + /** + * Move the scrolled positionof the webview. + * + * @param { number } deltaX - The amount of pixels to scroll by horizontally. + * @param { number } deltaY - The amount of pixels to scroll by vertically. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 17100001 - Init error. + * The WebviewController must be associated with a Web component. + * + * @since 9 + */ + scrollBy(deltaX: number, deltaY:number): void; + + /** + * Simulate speed sliding behavior to scroll the webview. + * + * @param { number } vx - The speed sliding behavior by horizontally. + * @param { number } vy - The speed sliding behavior by vertically. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 17100001 - Init error. + * The WebviewController must be associated with a Web component. + * + * @since 9 + */ + slideScroll(vx: number, vy:number): void; + + /** + * Scroll the contents of this Webview up by half the view size. + * + * @param { boolean } top - Jump to the top of the page if true. + * @throws { BusinessError } 17100001 - Init error. + * The WebviewController must be associated with a Web component. + * + * @since 9 + */ + pageUp(top:boolean): void; + + /** + * Scroll the contents of this Webview down by half the view size. + * + * @param { boolean } bottom - Jump to the bottom of the page if true. + * @throws { BusinessError } 17100001 - Init error. + * The WebviewController must be associated with a Web component. + * + * @since 9 + */ + pageDown(bottom:boolean): void; + + /** + * Gets the original url of current Web page. + * + * @throws { BusinessError } 17100001 - Init error. + * The WebviewController must be associated with a Web component. + * @returns { string } Return the the original url of the current page. + * + * @since 9 + */ + getOriginalUrl(): string; + + /** + * Gets the original url of current Web page. + * + * @throws { BusinessError } 17100001 - Init error. + * The WebviewController must be associated with a Web component. + * @returns { string } Return the the original url of the current page. + * + * @since 9 + */ + getFavicon(): image.PixelMap; + + /** + * Put network state for web. Which is used to set window.navigator.isOnline property in + * JavaScript. + * + * @throws { BusinessError } 17100001 - Init error. + * The WebviewController must be associated with a Web component. + * + * @since 9 + */ + putNetworkAvailable(): void; + + /** + * Qurey if current document has image. + * + * @param { AsyncCallback } callback - Called after query image has finished. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 17100001 - Init error. + * The WebviewController must be associated with a Web component. + * @return { Promise } A promise resolved after query image has finished. + * + * @since 9 + */ + hasImage(): Promise; + hasImage(callback: AsyncCallback): void; + + /** + * Get back forward stack list from current webview. + * + * @throws { BusinessError } 17100001 - Init error. + * The WebviewController must be associated with a Web component. + * @return { BackForwardList } Back forward list for current webview. + * + * @since 9 + */ + getBackForwardEntries(): BackForwardList; + + /** + * Serialize back forward list of the current webview. + * + * @throws { BusinessError } 17100001 - Init error. + * The WebviewController must be associated with a Web component. + * @return { rpc.MessageSequence } A messageSequence which is from current back forward state. + * + * @since 9 + */ + serializeWebState(): rpc.MessageSequence; + + /** + * Restore the back forward state to current webview from state MessageSequence. + * + * @param { rpc.MessageSequence } state - A messageSequence which is represented back forward state. + * @throws { BusinessError } 17100001 - Init error. + * The WebviewController must be associated with a Web component. + * + * @since 9 + */ + restoreWebState(state: rpc.MessageSequence): void; + + /** + * Remove resource cache in application. So this method will Remove all cache for all webviews in the + * same application. + * + * @param { boolean } clearRom - Remove cache in both rom and ram if true. Otherwise only clear cache + * in ram. + * @throws { BusinessError } 17100001 - Init error. + * The WebviewController must be associated with a Web component. + * + */ + removeCache(clearRom: boolean): void; } }