diff --git a/interfaces/kits/js/@ohos.accessibility.GesturePath.d.ts b/interfaces/kits/js/@ohos.accessibility.GesturePath.d.ts index 13e8d8d21bbd5101380117938eef4df3e899226c..1f1a3ed9143007c3a20df110d5d647b731480479 100644 --- a/interfaces/kits/js/@ohos.accessibility.GesturePath.d.ts +++ b/interfaces/kits/js/@ohos.accessibility.GesturePath.d.ts @@ -14,23 +14,29 @@ */ import type { GesturePoint } from './@ohos.accessibility.GesturePoint'; -import { GesturePoint } from "./@ohos.accessibility.GesturePoint"; /** * Indicates the path of the gesture. + * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 9 */ export declare class GesturePath { - constructor(durationTime: number); - /** - * Indicates the position of the points that make up the gesture. - * @type {Array} - */ - points: Array; - /** - * Indicates the duration of the gesture. - * @type {number} - */ - durationTime: number; -} \ No newline at end of file + constructor(durationTime: number); + /** + * Indicates the position of the points that make up the gesture. + * + * @type { Array } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + points: Array; + /** + * Indicates the duration of the gesture. + * + * @type { number } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + durationTime: number; +} diff --git a/interfaces/kits/js/@ohos.accessibility.GesturePoint.d.ts b/interfaces/kits/js/@ohos.accessibility.GesturePoint.d.ts index 53ff7625216507abbec9ae645c165d7644d4a62a..ad182e8c028616c0aabeee796b36c7a08712a379 100644 --- a/interfaces/kits/js/@ohos.accessibility.GesturePoint.d.ts +++ b/interfaces/kits/js/@ohos.accessibility.GesturePoint.d.ts @@ -15,19 +15,26 @@ /** * Indicates the point of the gesture. + * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 9 */ - export declare class GesturePoint { - constructor(positionX: number, positionY: number); - /** - * Indicates the X coordinate of point. - * @type {number} - */ - positionX: number; - /** - * Indicates the Y coordinate of point. - * @type {number} - */ - positionY: number; -} \ No newline at end of file +export declare class GesturePoint { + constructor(positionX: number, positionY: number); + /** + * Indicates the X coordinate of point. + * + * @type { number } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + positionX: number; + /** + * Indicates the Y coordinate of point. + * + * @type { number } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + positionY: number; +} diff --git a/interfaces/kits/js/@ohos.accessibility.config.d.ts b/interfaces/kits/js/@ohos.accessibility.config.d.ts index c785b80207111a986aafe873368d105fff4588ba..b8a3ab50a559d57c1bf9f6433c4397256729509c 100644 --- a/interfaces/kits/js/@ohos.accessibility.config.d.ts +++ b/interfaces/kits/js/@ohos.accessibility.config.d.ts @@ -19,148 +19,310 @@ import type { AsyncCallback, Callback } from './basic'; /** * Configuration of the accessibility. * - * @since 9 + * @namespace config * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi + * @since 9 */ declare namespace config { /** * Indicates the configuration of high-contrast text. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ let highContrastText: Config; /** * Indicates the configuration of invert color. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ let invertColor: Config; /** * Indicates the configuration of daltonization color filter. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ let daltonizationColorFilter: Config; /** * Indicates the configuration of content timeout. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ let contentTimeout: Config; /** * Indicates the configuration of animation state. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ let animationOff: Config; /** * Indicates the configuration of brightness discount. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ let brightnessDiscount: Config; /** * Indicates the configuration of screen magnifier. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ let screenMagnifier: Config; /** * Indicates the configuration of audio mono. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ let audioMono: Config; /** * Indicates the configuration of audio balance. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ let audioBalance: Config; /** * Indicates the configuration of mouse key state. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ let mouseKey: Config; /** * Indicates the configuration of mouse auto click. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ let mouseAutoClick: Config; /** * Indicates the configuration of short key state. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ let shortkey: Config; /** * Indicates the configuration of short key target. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ let shortkeyTarget: Config; /** * Indicates the configuration of captions state. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ let captions: Config; /** * Indicates the configuration of captions style. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ let captionsStyle: Config; /** * Enable the accessibility extension ability. - * @param name Indicates the accessibility extension name, in "bundleName/abilityName" format. - * @param capability Indicates the ability. + * + * @param { string } name Indicates the accessibility extension name, in "bundleName/abilityName" format. + * @param { Array } capability Indicates the ability. + * @returns { Promise } * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - Input parameter error. * @throws { BusinessError } 9300001 - Invalid bundle name or ability name. * @throws { BusinessError } 9300002 - Target ability already enabled. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ function enableAbility(name: string, capability: Array): Promise; - function enableAbility(name: string, capability: Array, callback: AsyncCallback): void; + + /** + * Enable the accessibility extension ability. + * + * @param { string } name Indicates the accessibility extension name, in "bundleName/abilityName" format. + * @param { Array } capability Indicates the ability. + * @param { AsyncCallback } callback + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system App. + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300001 - Invalid bundle name or ability name. + * @throws { BusinessError } 9300002 - Target ability already enabled. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 + */ + function enableAbility( + name: string, + capability: Array, + callback: AsyncCallback + ): void; /** * Disable the accessibility extension ability. - * @param name Indicates the accessibility extension name, in "bundleName/abilityName" format. + * + * @param { string } name Indicates the accessibility extension name, in "bundleName/abilityName" format. + * @returns { Promise } * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - Input parameter error. * @throws { BusinessError } 9300001 - Invalid bundle name or ability name. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ function disableAbility(name: string): Promise; + + /** + * Disable the accessibility extension ability. + * + * @param { string } name Indicates the accessibility extension name, in "bundleName/abilityName" format. + * @param { AsyncCallback } callback + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system App. + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300001 - Invalid bundle name or ability name. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 + */ function disableAbility(name: string, callback: AsyncCallback): void; /** * Register the listener that watches for changes in the enabled status of accessibility extensions. - * @param type Indicates the type of event. - * @param callback Indicates the listener. + * + * @param { 'enabledAccessibilityExtensionListChange' } type Indicates the type of event. + * @param { Callback } callback Indicates the listener. * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ function on(type: 'enabledAccessibilityExtensionListChange', callback: Callback): void; /** * Deregister listener that watches for changes in the enabled status of accessibility extensions. - * @param type Indicates the type of event. - * @param callback Indicates the listener. + * + * @param { 'enabledAccessibilityExtensionListChange' } type Indicates the type of event. + * @param { Callback } callback Indicates the listener. * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ function off(type: 'enabledAccessibilityExtensionListChange', callback?: Callback): void; /** * Indicates setting, getting, and listening to changes in configuration. + * + * @typedef Config + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ interface Config { /** * Setting configuration value. - * @param value Indicates the value. + * + * @param { T } value Indicates the value. + * @returns { Promise } * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ set(value: T): Promise; + + /** + * Setting configuration value. + * + * @param { T } value Indicates the value. + * @param { AsyncCallback } callback + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system App. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 + */ set(value: T, callback: AsyncCallback): void; /** * Getting configuration value. + * + * @returns { Promise } * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ get(): Promise; + + /** + * Getting configuration value. + * + * @param { AsyncCallback } callback + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system App. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 + */ get(callback: AsyncCallback): void; /** * Register the listener to listen for configuration changes. - * @param callback Indicates the listener. + * + * @param { Callback } callback Indicates the listener. * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ on(callback: Callback): void; /** * Deregister the listener to listen for configuration changes. - * @param callback Indicates the listener. + * + * @param { Callback } callback Indicates the listener. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @systemapi + * @since 9 */ off(callback?: Callback): void; } /** * Indicates the type of daltonization color filter. + * + * @systemapi */ type DaltonizationColorFilter = 'Normal' | 'Protanomaly' | 'Deuteranomaly' | 'Tritanomaly'; } -export default config; \ No newline at end of file +export default config; diff --git a/interfaces/kits/js/@ohos.accessibility.d.ts b/interfaces/kits/js/@ohos.accessibility.d.ts index 443a70034b7e97f90e7799f97e0d7b10de04920e..1d20a767b04606eb226217fdb1de749223bc5e85 100644 --- a/interfaces/kits/js/@ohos.accessibility.d.ts +++ b/interfaces/kits/js/@ohos.accessibility.d.ts @@ -18,21 +18,23 @@ import type { Callback } from './basic'; /** * Accessibility - * @name Accessibility - * @since 7 + * + * @namespace accessibility * @syscap SystemCapability.BarrierFree.Accessibility.Core - * @import basic,abilityInfo + * @since 7 */ declare namespace accessibility { /** * The type of the Ability app. + * * @type { 'audible' | 'generic' | 'haptic' | 'spoken' | 'visual' } * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ /** * The type of the Ability app. - * @type { 'audible' | 'generic' | 'haptic' | 'spoken' | 'visual' | 'all' } + * + * @type { 'audible' | 'generic' | 'haptic' | 'spoken' | 'visual' | 'all' } * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 9 */ @@ -40,6 +42,7 @@ declare namespace accessibility { /** * The action that the ability can execute. + * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ @@ -49,12 +52,8 @@ declare namespace accessibility { /** * The type of the accessibility event. - * @note windowsChange - * @note windowContentChange - * @note windowStateChange - * @note announcement - * @note notificationChange - * @note textTraversedAtMove + * windowsChange/windowContentChange/windowStateChange/announcement/notificationChange/textTraversedAtMove + * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ @@ -64,7 +63,8 @@ declare namespace accessibility { /** * The change type of the windowsChange event. - * @note It's used when received the {@code windowsChange} event. + * It's used when received the {@code windowsChange} event. + * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ @@ -72,6 +72,7 @@ declare namespace accessibility { /** * The type of the ability state. + * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ @@ -79,12 +80,13 @@ declare namespace accessibility { /** * The ability that accessibility subsystem support. - * @note touchExplorer: Describes the capability to talkback. + * touchExplorer: Describes the capability to talkback. * magnification: Describes the capability to request to control the display magnification. * gesturesSimulation: Describes the capability to request to simulate the gesture. * windowContent: Describes the capability to search for the content of the active window. * filterKeyEvents: Describes the capability to request to filter key events. * fingerprintGesture: Describes the capability to request to fingerprint gesture. + * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ @@ -92,7 +94,7 @@ declare namespace accessibility { /** * The granularity of text move. - * @note The granularity of text move. + * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ @@ -100,218 +102,345 @@ declare namespace accessibility { /** * Checks whether accessibility ability is enabled. - * @since 7 - * @param callback Asynchronous callback interface. + * + * @param { AsyncCallback } callback Asynchronous callback interface. * @syscap SystemCapability.BarrierFree.Accessibility.Core - * @return Returns {@code true} if the accessibility is enabled; returns {@code false} otherwise. + * @since 7 */ function isOpenAccessibility(callback: AsyncCallback): void; + + /** + * Checks whether accessibility ability is enabled. + * + * @param { AsyncCallback } callback Asynchronous callback interface. + * @returns { Promise } Returns {@code true} if the accessibility is enabled; returns {@code false} otherwise. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ function isOpenAccessibility(): Promise; /** * Checks touch browser ability (which is used by talkback) is enabled. - * @since 7 - * @param callback Asynchronous callback interface. + * + * @param { AsyncCallback } callback Asynchronous callback interface. * @syscap SystemCapability.BarrierFree.Accessibility.Vision - * @return Returns {@code true} if the touch browser is enabled; returns {@code false} otherwise. + * @since 7 */ function isOpenTouchGuide(callback: AsyncCallback): void; + + /** + * Checks touch browser ability (which is used by talkback) is enabled. + * + * @param { AsyncCallback } callback Asynchronous callback interface. + * @returns { Promise } Returns {@code true} if the touch browser is enabled; returns {@code false} otherwise. + * @syscap SystemCapability.BarrierFree.Accessibility.Vision + * @since 7 + */ function isOpenTouchGuide(): Promise; /** * Queries the list of accessibility abilities. + * + * @param { AbilityType } abilityType The type of the accessibility ability. {@code AbilityType} eg.spoken + * @param { AbilityState } stateType The state of the accessibility ability. {@code AbilityState} eg.installed + * @param { AsyncCallback> } callback + * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 * @deprecated since 9 - * @param abilityType The type of the accessibility ability. {@code AbilityType} eg.spoken - * @param stateType The state of the accessibility ability. {@code AbilityState} eg.installed + */ + function getAbilityLists( + abilityType: AbilityType, + stateType: AbilityState, + callback: AsyncCallback> + ): void; + + /** + * Queries the list of accessibility abilities. + * + * @param { AbilityType } abilityType The type of the accessibility ability. {@code AbilityType} eg.spoken + * @param { AbilityState } stateType The state of the accessibility ability. {@code AbilityState} eg.installed + * @returns { Promise> } Returns the list of abilityInfos. * @syscap SystemCapability.BarrierFree.Accessibility.Core - * @return Returns the list of abilityInfos. + * @since 7 + * @deprecated since 9 */ - function getAbilityLists(abilityType: AbilityType, stateType: AbilityState, - callback: AsyncCallback>): void; - function getAbilityLists(abilityType: AbilityType, - stateType: AbilityState): Promise>; + function getAbilityLists(abilityType: AbilityType, stateType: AbilityState): Promise>; /** * Queries the list of accessibility abilities. - * @since 9 - * @param abilityType The type of the accessibility ability. {@code AbilityType} eg.spoken - * @param stateType The state of the accessibility ability. {@code AbilityState} eg.installed + * + * @param { AbilityType } abilityType The type of the accessibility ability. {@code AbilityType} eg.spoken + * @param { AbilityState } stateType The state of the accessibility ability. {@code AbilityState} eg.installed + * @returns { Promise> } Returns the list of abilityInfos. + * @throws { BusinessError } 401 - Input parameter error. * @syscap SystemCapability.BarrierFree.Accessibility.Core - * @return Returns the list of abilityInfos. + * @since 9 + */ + function getAccessibilityExtensionList( + abilityType: AbilityType, + stateType: AbilityState + ): Promise>; + + /** + * Queries the list of accessibility abilities. + * + * @param { AbilityType } abilityType The type of the accessibility ability. {@code AbilityType} eg.spoken + * @param { AbilityState } stateType The state of the accessibility ability. {@code AbilityState} eg.installed + * @param { AsyncCallback> } callback * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 */ - function getAccessibilityExtensionList(abilityType: AbilityType, stateType: AbilityState): Promise>; - function getAccessibilityExtensionList(abilityType: AbilityType, stateType: AbilityState, callback: AsyncCallback>): void; + function getAccessibilityExtensionList( + abilityType: AbilityType, + stateType: AbilityState, + callback: AsyncCallback> + ): void; /** * Send accessibility Event. + * + * @param { EventInfo } event The object of the accessibility {@code EventInfo} . + * @param { AsyncCallback } callback Asynchronous callback interface. + * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 * @deprecated since 9 - * @param event The object of the accessibility {@code EventInfo} . - * @param callback Asynchronous callback interface. - * @syscap SystemCapability.BarrierFree.Accessibility.Core - * @return Returns {@code true} if success ; returns {@code false} otherwise. */ function sendEvent(event: EventInfo, callback: AsyncCallback): void; + + /** + * Send accessibility Event. + * + * @param { EventInfo } event The object of the accessibility {@code EventInfo} . + * @returns { Promise } Returns {@code true} if success ; returns {@code false} otherwise. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + * @deprecated since 9 + */ function sendEvent(event: EventInfo): Promise; /** * Send accessibility event. - * @since 9 - * @param event The object of the accessibility {@code EventInfo} . - * @param callback Asynchronous callback interface. - * @syscap SystemCapability.BarrierFree.Accessibility.Core - * @return Returns {@code true} if success ; returns {@code false} otherwise. + * + * @param { EventInfo } event The object of the accessibility {@code EventInfo} . + * @param { AsyncCallback } callback Asynchronous callback interface. * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 */ function sendAccessibilityEvent(event: EventInfo, callback: AsyncCallback): void; + + /** + * Send accessibility event. + * + * @param { EventInfo } event The object of the accessibility {@code EventInfo} . + * @returns { Promise } Returns {@code true} if success ; returns {@code false} otherwise. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ function sendAccessibilityEvent(event: EventInfo): Promise; /** * Register the observe of the accessibility state changed. - * @since 7 - * @param type state event type. - * @param callback Asynchronous callback interface. - * @syscap SystemCapability.BarrierFree.Accessibility.Core - * @return Returns {@code true} if the register is success ; returns {@code false} otherwise. + * + * @param { 'accessibilityStateChange' } type state event type. + * @param { Callback } callback Asynchronous callback interface. * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 */ function on(type: 'accessibilityStateChange', callback: Callback): void; /** * Register the observe of the touchGuide state changed. - * @since 7 - * @param type state event type. - * @param callback Asynchronous callback interface. - * @syscap SystemCapability.BarrierFree.Accessibility.Vision - * @return Returns {@code true} if the register is success ; returns {@code false} otherwise. + * + * @param { 'touchGuideStateChange' } type state event type. + * @param { Callback } callback Asynchronous callback interface. * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Vision + * @since 7 */ function on(type: 'touchGuideStateChange', callback: Callback): void; /** * Deregister the observe of the accessibility state changed. - * @since 7 - * @param type state event type - * @param callback Asynchronous callback interface. - * @syscap SystemCapability.BarrierFree.Accessibility.Core - * @return Returns {@code true} if the deregister is success ; returns {@code false} otherwise. + * + * @param { 'accessibilityStateChange' } type state event type + * @param { Callback } callback Asynchronous callback interface. * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 */ function off(type: 'accessibilityStateChange', callback?: Callback): void; /** * Deregister the observe of the touchGuide state changed. - * @since 7 - * @param type state event type - * @param callback Asynchronous callback interface. - * @return Returns {@code true} if the deregister is success ; returns {@code false} otherwise. + * + * @param { 'touchGuideStateChange' } type state event type + * @param { Callback } callback Asynchronous callback interface. * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 */ - function off(type: 'touchGuideStateChange', callback?: Callback): void; + function off(type: 'touchGuideStateChange', callback?: Callback): void; /** * Get the captions manager. + * + * @returns { CaptionsManager } Returns the captions manager. + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + function getCaptionsManager(): CaptionsManager; + + /** + * Indicates the captions manager. + * + * @typedef CaptionsManager + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + interface CaptionsManager { + /** + * Indicates whether captions are enabled. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + enabled: boolean; + /** + * Indicates the style of captions. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + style: CaptionsStyle; + + /** + * Register the observe of the enable state. + * + * @param { 'enableChange' } type + * @param { Callback } callback + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + on(type: 'enableChange', callback: Callback): void; + + /** + * Register the observer of the style. + * + * @param { 'styleChange' } type + * @param { Callback } callback + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + on(type: 'styleChange', callback: Callback): void; + + /** + * Deregister the observe of the enable state. + * + * @param { 'enableChange' } type + * @param { Callback } callback + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + off(type: 'enableChange', callback?: Callback): void; + + /** + * Deregister the observer of the style. + * + * @param { 'styleChange' } type + * @param { Callback } callback + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + off(type: 'styleChange', callback?: Callback): void; + } + + /** + * Indicates the edge type of the captions font. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + type CaptionsFontEdgeType = 'none' | 'raised' | 'depressed' | 'uniform' | 'dropShadow'; + /** + * Indicates the font family of captions. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + type CaptionsFontFamily = 'default' | 'monospacedSerif' | 'serif' | + 'monospacedSansSerif' | 'sansSerif' | 'casual' | 'cursive' | 'smallCapitals'; + /** + * Indicates the style of captions. + * + * @typedef CaptionsStyle * @syscap SystemCapability.BarrierFree.Accessibility.Hearing * @since 8 - * @return Returns the captions manager. */ - function getCaptionsManager(): CaptionsManager; - - /** - * Indicates the captions manager. - * @syscap SystemCapability.BarrierFree.Accessibility.Hearing - * @since 8 - */ - interface CaptionsManager { - /** - * Indicates whether captions are enabled. - */ - enabled: boolean; - /** - * Indicates the style of captions. - */ - style: CaptionsStyle; - - /** - * Register the observe of the enable state. - * @throws { BusinessError } 401 - Input parameter error. - */ - on(type: 'enableChange', callback: Callback): void; - - /** - * Register the observer of the style. - * @throws { BusinessError } 401 - Input parameter error. - */ - on(type: 'styleChange', callback: Callback): void; - - /** - * Deregister the observe of the enable state. - * @throws { BusinessError } 401 - Input parameter error. - */ - off(type: 'enableChange', callback?: Callback): void; - - /** - * Deregister the observer of the style. - * @throws { BusinessError } 401 - Input parameter error. - */ - off(type: 'styleChange', callback?: Callback): void; - } - - /** - * Indicates the edge type of the captions font. - * @syscap SystemCapability.BarrierFree.Accessibility.Hearing - * @since 8 - */ - type CaptionsFontEdgeType = 'none' | 'raised' | 'depressed' | 'uniform' | 'dropShadow'; - /** - * Indicates the font family of captions. - * @syscap SystemCapability.BarrierFree.Accessibility.Hearing - * @since 8 - */ - type CaptionsFontFamily = 'default' | 'monospacedSerif' | 'serif' | - 'monospacedSansSerif' | 'sansSerif' | 'casual' | 'cursive' | 'smallCapitals'; - /** - * Indicates the style of captions. - * @syscap SystemCapability.BarrierFree.Accessibility.Hearing - * @since 8 - */ - interface CaptionsStyle { - /** - * Indicates the font family of captions. - */ - fontFamily: CaptionsFontFamily; - /** - * Indicates the font scaling of captions. - */ - fontScale: number; - /** - * Indicates the font color of captions. - */ - fontColor: number | string; - /** - * Indicates the edge type of the captions font. - */ - fontEdgeType: CaptionsFontEdgeType; - /** - * Indicates the background color of captions. - */ - backgroundColor: number | string; - /** - * Indicates the window color of captions. - */ - windowColor: number | string; - } - - /** - * Indicates the info of accessibility. - * @syscap SystemCapability.BarrierFree.Accessibility.Core - * @since 7 - */ + interface CaptionsStyle { + /** + * Indicates the font family of captions. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + fontFamily: CaptionsFontFamily; + /** + * Indicates the font scaling of captions. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + fontScale: number; + /** + * Indicates the font color of captions. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + fontColor: number | string; + /** + * Indicates the edge type of the captions font. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + fontEdgeType: CaptionsFontEdgeType; + /** + * Indicates the background color of captions. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + backgroundColor: number | string; + /** + * Indicates the window color of captions. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + windowColor: number | string; + } + + /** + * Indicates the info of accessibility. + * + * @typedef AccessibilityAbilityInfo + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ interface AccessibilityAbilityInfo { /** * The ability id. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ readonly id: string; @@ -333,121 +462,156 @@ declare namespace accessibility { /** * The type of the ability. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ readonly abilityTypes: Array; /** * The capabilities of the ability. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ readonly capabilities: Array; /** * The description of the ability. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ readonly description: string; /** * The events which the accessibility ability wants to observe. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ readonly eventTypes: Array; - } /** - * Indicates the info of events. - * @syscap SystemCapability.BarrierFree.Accessibility.Core - * @since 7 - */ + * Indicates the info of events. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ class EventInfo { constructor(jsonObject); /** * The type of an accessibility event. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ type: EventType; /** * The type of the window change event. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ windowUpdateType?: WindowUpdateType; /** * The bundle name of the target application. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ bundleName: string; /** * The type of the event source component,such as button, chart. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ componentType?: string; - /** The page id of the event source. + /** + * The page id of the event source. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ - pageId ?: number; + pageId?: number; /** * The accessibility event description. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ description?: string; /** * The action that triggers the accessibility event, for example, clicking or focusing a view. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ triggerAction: Action; /** * The movement step used for reading texts. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ textMoveUnit?: TextMoveUnit; /** * The content list. - * @note + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ contents?: Array; /** * The content changed before. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ lastContent?: string; /** * The start index of listed items on the screen. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ beginIndex?: number; /** * The index of the current item on the screen. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ currentIndex?: number; /** * The end index of listed items on the screen. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ endIndex?: number; /** - * The total of the items. - * @note talkback used it when scroll. + * The total of the items, talkback used it when scroll. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ itemCount?: number; } } -export default accessibility; \ No newline at end of file +export default accessibility; diff --git a/interfaces/kits/js/@ohos.application.AccessibilityExtensionAbility.d.ts b/interfaces/kits/js/@ohos.application.AccessibilityExtensionAbility.d.ts index c0c6e521c4c71b99581088c94e2f9be6d8bd68e2..708ff10cc7df3812d0d154b553f14d6690aefd70 100644 --- a/interfaces/kits/js/@ohos.application.AccessibilityExtensionAbility.d.ts +++ b/interfaces/kits/js/@ohos.application.AccessibilityExtensionAbility.d.ts @@ -16,79 +16,95 @@ import type accessibility from './@ohos.accessibility'; import type AccessibilityExtensionContext, { AccessibilityElement } from './application/AccessibilityExtensionContext'; import type { KeyEvent } from './@ohos.multimodalInput.keyEvent'; -import accessibility from './@ohos.accessibility' -import AccessibilityExtensionContext, { AccessibilityElement } from './application/AccessibilityExtensionContext' -import { KeyEvent } from './@ohos.multimodalInput.keyEvent' /** * class of accessibility extension ability. * - * @since 9 * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 */ export default class AccessibilityExtensionAbility { - /** - * Indicates accessibility extension ability context. - */ - context: AccessibilityExtensionContext; + /** + * Indicates accessibility extension ability context. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + context: AccessibilityExtensionContext; - /** - * Called when extension ability is connected. - */ - onConnect(): void; + /** + * Called when extension ability is connected. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + onConnect(): void; - /** - * Called when extension ability is disconnected. - */ - onDisconnect(): void; + /** + * Called when extension ability is disconnected. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + onDisconnect(): void; - /** - * Called when an accessibility event occurs, such as when the user touches the application interface. - * @param event Indicates an accessibility event. - */ - onAccessibilityEvent(event: AccessibilityEvent): void; + /** + * Called when an accessibility event occurs, such as when the user touches the application interface. + * + * @param { AccessibilityEvent } event Indicates an accessibility event. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + onAccessibilityEvent(event: AccessibilityEvent): void; - /** - * Called when a physical key is pressed, such as when the user presses the volume button . - * @param keyEvent Indicates the physical key event. - */ - onKeyEvent(keyEvent: KeyEvent): boolean; + /** + * Called when a physical key is pressed, such as when the user presses the volume button . + * + * @param { KeyEvent } keyEvent Indicates the physical key event. + * @returns { boolean } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + onKeyEvent(keyEvent: KeyEvent): boolean; } /** * Indicates the accessibility event. - * * It provides the event type and the target element of the event if any. - * @since 9 + * + * @typedef AccessibilityEvent * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 */ declare interface AccessibilityEvent { - eventType: accessibility.EventType | accessibility.WindowUpdateType | - TouchGuideType | GestureType | PageUpdateType; - target?: AccessibilityElement; - timeStamp?: number; + eventType: accessibility.EventType | accessibility.WindowUpdateType | TouchGuideType | GestureType | PageUpdateType; + target?: AccessibilityElement; + timeStamp?: number; } /** * Indicates the gusture type. - * @since 9 + * * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 */ type GestureType = 'left' | 'leftThenRight' | 'leftThenUp' | 'leftThenDown' | - 'right' | 'rightThenLeft' | 'rightThenUp' | 'rightThenDown' | - 'up' | 'upThenLeft' | 'upThenRight' | 'upThenDown' | - 'down' | 'downThenLeft' | 'downThenRight' | 'downThenUp'; + 'right' | 'rightThenLeft' | 'rightThenUp' | 'rightThenDown' | + 'up' | 'upThenLeft' | 'upThenRight' | 'upThenDown' | + 'down' | 'downThenLeft' | 'downThenRight' | 'downThenUp'; /** * Indicates the page update type. - * @since 9 + * * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 */ type PageUpdateType = 'pageContentUpdate' | 'pageStateUpdate'; /** * Indicates the type of touch event during touch browsing. - * @since 9 + * * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 */ -type TouchGuideType = 'touchBegin' | 'touchEnd'; \ No newline at end of file +type TouchGuideType = 'touchBegin' | 'touchEnd'; diff --git a/interfaces/kits/js/AccessibilityExtensionContext.d.ts b/interfaces/kits/js/AccessibilityExtensionContext.d.ts index 8fe61eebd7b9f3f6908630b558c2dd3e588236ab..96ea0121a00ff4e5b84ed9d650e11fb0960f4cfb 100644 --- a/interfaces/kits/js/AccessibilityExtensionContext.d.ts +++ b/interfaces/kits/js/AccessibilityExtensionContext.d.ts @@ -17,372 +17,719 @@ import type { AsyncCallback } from '../basic'; import ExtensionContext from './ExtensionContext'; import type accessibility from '../@ohos.accessibility'; import type { GesturePath } from '../@ohos.accessibility.GesturePath'; -import { AsyncCallback } from "../basic"; -import ExtensionContext from "./ExtensionContext"; -import accessibility from "../@ohos.accessibility"; -import { GesturePath } from "../@ohos.accessibility.GesturePath"; /** * The accessibility extension context. Used to configure, query information, and inject gestures. * - * @since 9 + * @extends ExtensionContext * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 */ export default class AccessibilityExtensionContext extends ExtensionContext { - /** - * Set the bundle names that is interested in sending the event. - * @param targetNames The bundle names that are interested in sending the event. - * @param callback Indicates the listener. - * @throws { BusinessError } 401 - Input parameter error. - */ - setTargetBundleName(targetNames: Array, callback: AsyncCallback): void; - setTargetBundleName(targetNames: Array): Promise; - - /** - * Get focus element. - * @param isAccessibilityFocus Indicates whether the acquired element has an accessibility focus. - * @param callback Indicates the listener. - * @throws { BusinessError } 401 - Input parameter error. - * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. - */ - getFocusElement(isAccessibilityFocus: boolean, callback: AsyncCallback): void; - getFocusElement(isAccessibilityFocus?: boolean): Promise; - getFocusElement(callback: AsyncCallback): void; - - /** - * Get window root element. - * @param windowId Indicates the window ID. - * @param callback Indicates the listener. - * @throws { BusinessError } 401 - Input parameter error. - * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. - */ - getWindowRootElement(windowId: number, callback: AsyncCallback): void; - getWindowRootElement(windowId?: number): Promise; - getWindowRootElement(callback: AsyncCallback): void; - - /** - * Get window list. - * @param displayId Indicates the display ID. - * @param callback Indicates the listener. - * @throws { BusinessError } 401 - Input parameter error. - * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. - */ - getWindows(displayId: number, callback: AsyncCallback>): void; - getWindows(displayId?: number): Promise>; - getWindows(callback: AsyncCallback>): void; - - /** - * Inject gesture path events. - * @param gesturePath Indicates the gesture path. - * @param callback Indicates the listener. - * @throws { BusinessError } 401 - Input parameter error. - * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. - */ - injectGesture(gesturePath: GesturePath, callback: AsyncCallback): void; - injectGesture(gesturePath: GesturePath): Promise; + /** + * Set the bundle names that is interested in sending the event. + * + * @param { Array } targetNames The bundle names that are interested in sending the event. + * @param { AsyncCallback } callback Indicates the listener. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + setTargetBundleName(targetNames: Array, callback: AsyncCallback): void; + + /** + * Set the bundle names that is interested in sending the event. + * + * @param { Array } targetNames The bundle names that are interested in sending the event. + * @returns { Promise } + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + setTargetBundleName(targetNames: Array): Promise; + + /** + * Get focus element. + * + * @param { boolean } isAccessibilityFocus Indicates whether the acquired element has an accessibility focus. + * @param { AsyncCallback } callback Indicates the listener. + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + getFocusElement(isAccessibilityFocus: boolean, callback: AsyncCallback): void; + + /** + * Get focus element. + * + * @param { boolean } isAccessibilityFocus Indicates whether the acquired element has an accessibility focus. + * @returns { Promise } + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + getFocusElement(isAccessibilityFocus?: boolean): Promise; + + /** + * Get focus element. + * @param { AsyncCallback } callback Indicates the listener. + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + getFocusElement(callback: AsyncCallback): void; + + /** + * Get window root element. + * + * @param { number } windowId Indicates the window ID. + * @param { AsyncCallback } callback Indicates the listener. + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + getWindowRootElement(windowId: number, callback: AsyncCallback): void; + + /** + * Get window root element. + * + * @param { number } windowId Indicates the window ID. + * @returns { Promise } + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + getWindowRootElement(windowId?: number): Promise; + + /** + * Get window root element. + * @param { AsyncCallback } callback Indicates the listener. + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + getWindowRootElement(callback: AsyncCallback): void; + + /** + * Get window list. + * + * @param { number } displayId Indicates the display ID. + * @param { AsyncCallback> } callback Indicates the listener. + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + getWindows(displayId: number, callback: AsyncCallback>): void; + + /** + * Get window list. + * + * @param { number } displayId Indicates the display ID. + * @returns { Promise> } + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + getWindows(displayId?: number): Promise>; + + /** + * Get window list. + * @param { AsyncCallback> } callback Indicates the listener. + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + getWindows(callback: AsyncCallback>): void; + + /** + * Inject gesture path events. + * + * @param { GesturePath } gesturePath Indicates the gesture path. + * @param { AsyncCallback } callback Indicates the listener. + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + injectGesture(gesturePath: GesturePath, callback: AsyncCallback): void; + + /** + * Inject gesture path events. + * + * @param { GesturePath } gesturePath Indicates the gesture path. + * @returns { Promise } + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + injectGesture(gesturePath: GesturePath): Promise; } /** * Indicates an accessibility element. - * * Supports querying element attributes, requesting execution actions, and finding child elements by condition. - * @since 9 + * + * @typedef AccessibilityElement * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 */ declare interface AccessibilityElement { - /** - * Get a list of attribute names. - * @param callback Indicates the listener. - */ - attributeNames(callback: AsyncCallback>): void; - attributeNames(): Promise>; - - /** - * Get the value of an attribute. - * @param attributeName Indicates the attribute name. - * @param callback Indicates the listener. - * @throws { BusinessError } 401 - Input parameter error. - * @throws { BusinessError } 9300004 - This property does not exist. - */ - attributeValue(attributeName: T, - callback: AsyncCallback): void; - attributeValue(attributeName: T): Promise; - - /** - * Get a list of supported actions. - * @param callback Indicates the listener. - */ - actionNames(callback: AsyncCallback>): void; - actionNames(): Promise>; - - /** - * Perform the specified action. - * @param actionName Indicates the action name. - * @param parameters Indicates the parameters needed to execute the action. - * @param callback Indicates the listener. - * @throws { BusinessError } 401 - Input parameter error. - * @throws { BusinessError } 9300005 - This action is not supported. - */ - performAction(actionName: string, parameters: object, callback: AsyncCallback): void; - performAction(actionName: string, parameters?: object): Promise; - performAction(actionName: string, callback: AsyncCallback): void; - - /** - * Find elements that match the condition. - * @param type The type of query condition is content. - * @param condition Indicates the specific content to be queried. - * @param callback Indicates the listener. - * @throws { BusinessError } 401 - Input parameter error. - */ - findElement(type: 'content', condition: string, callback: AsyncCallback>): void - findElement(type: 'content', condition: string): Promise>; - - /** - * Find elements that match the condition. - * @param type The type of query condition is focus type. - * @param condition Indicates the type of focus to query. - * @param callback Indicates the listener. - * @throws { BusinessError } 401 - Input parameter error. - */ - findElement(type: 'focusType', condition: FocusType, callback: AsyncCallback): void - findElement(type: 'focusType', condition: FocusType): Promise; - - /** - * Find elements that match the condition. - * @param type The type of query condition is focus direction. - * @param condition Indicates the direction of search focus to query. - * @param callback Indicates the listener. - * @throws { BusinessError } 401 - Input parameter error. - */ - findElement(type: 'focusDirection', condition: FocusDirection, callback: AsyncCallback): void - findElement(type: 'focusDirection', condition: FocusDirection): Promise; + /** + * Get a list of attribute names. + * + * @param { AsyncCallback> } callback Indicates the listener. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + attributeNames(callback: AsyncCallback>): void; + + /** + * Get a list of attribute names. + * @returns { Promise> } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + attributeNames(): Promise>; + + /** + * Get the value of an attribute. + * + * @param { T } attributeName Indicates the attribute name. + * @param { AsyncCallback } callback Indicates the listener. + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300004 - This property does not exist. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + attributeValue( + attributeName: T, + callback: AsyncCallback + ): void; + + /** + * Get the value of an attribute. + * + * @param { T } attributeName Indicates the attribute name. + * @returns { Promise } + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300004 - This property does not exist. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + attributeValue(attributeName: T): Promise; + + /** + * Get a list of supported actions. + * + * @param { AsyncCallback> } callback Indicates the listener. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + actionNames(callback: AsyncCallback>): void; + + /** + * Get a list of supported actions. + * + * @param { AsyncCallback> } callback Indicates the listener. + * @returns { Promise> } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + actionNames(): Promise>; + + /** + * Perform the specified action. + * + * @param { string } actionName Indicates the action name. + * @param { object } parameters Indicates the parameters needed to execute the action. + * @param { AsyncCallback } callback Indicates the listener. + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300005 - This action is not supported. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + performAction(actionName: string, parameters: object, callback: AsyncCallback): void; + + /** + * Perform the specified action. + * + * @param { string } actionName Indicates the action name. + * @param { object } parameters Indicates the parameters needed to execute the action. + * @returns { Promise } + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300005 - This action is not supported. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + performAction(actionName: string, parameters?: object): Promise; + + /** + * Perform the specified action. + * + * @param { string } actionName Indicates the action name. + * @param { AsyncCallback } callback Indicates the listener. + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300005 - This action is not supported. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + performAction(actionName: string, callback: AsyncCallback): void; + + /** + * Find elements that match the condition. + * + * @param { 'content' } type The type of query condition is content. + * @param { string } condition Indicates the specific content to be queried. + * @param { AsyncCallback> } callback Indicates the listener. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + findElement(type: 'content', condition: string, callback: AsyncCallback>): void; + + /** + * Find elements that match the condition. + * + * @param { 'content' } type The type of query condition is content. + * @param { string } condition Indicates the specific content to be queried. + * @returns { Promise> } + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + findElement(type: 'content', condition: string): Promise>; + + /** + * Find elements that match the condition. + * + * @param { 'focusType' } type The type of query condition is focus type. + * @param { FocusType } condition Indicates the type of focus to query. + * @param { AsyncCallback } callback Indicates the listener. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + findElement(type: 'focusType', condition: FocusType, callback: AsyncCallback): void; + + /** + * Find elements that match the condition. + * + * @param { 'focusType' } type The type of query condition is focus type. + * @param { FocusType } condition Indicates the type of focus to query. + * @returns { Promise } + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + findElement(type: 'focusType', condition: FocusType): Promise; + + /** + * Find elements that match the condition. + * + * @param { 'focusDirection' } type The type of query condition is focus direction. + * @param { FocusDirection } condition Indicates the direction of search focus to query. + * @param { AsyncCallback } callback Indicates the listener. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + findElement(type: 'focusDirection', condition: FocusDirection, callback: AsyncCallback): void; + + /** + * Find elements that match the condition. + * + * @param { 'focusDirection' } type The type of query condition is focus direction. + * @param { FocusDirection } condition Indicates the direction of search focus to query. + * @returns { Promise } + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + findElement(type: 'focusDirection', condition: FocusDirection): Promise; } /** * Indicates the possible attributes of the element and the type of the attribute value. - * @since 9 + * * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 */ type ElementAttributeValues = { - /** - * Indicates accessibility focus state. - */ - 'accessibilityFocused': boolean; - /** - * Indicates the bundle name to which it belongs. - */ - 'bundleName': string; - /** - * Indicates whether the element is checkable. - */ - 'checkable': boolean; - /** - * Indicates whether the element is checked. - */ - 'checked': boolean; - /** - * Indicates all child elements. - */ - 'children': Array; - /** - * Indicates whether the element is clickable. - */ - 'clickable': boolean; - /** - * Indicates the component ID to which the element belongs. - */ - 'componentId': number; - /** - * Indicates the component type to which the element belongs. - */ - 'componentType': string; - /** - * Indicates the content. - */ - 'contents': Array; - /** - * Indicates the index of the current item. - */ - 'currentIndex': number; - /** - * Indicates the description of the element. - */ - 'description': string; - /** - * Indicates whether the element is editable. - */ - 'editable': boolean; - /** - * Indicates the list index of the last item displayed on the screen. - */ - 'endIndex': number; - /** - * Indicates the string of error state. - */ - 'error': string; - /** - * Indicates whether the element is focusable. - */ - 'focusable': boolean; - /** - * Indicates the hint text. - */ - 'hintText': string; - /** - * Indicates the type of input text. - */ - 'inputType': number; - /** - * Indicates the inspector key. - */ - 'inspectorKey': string - /** - * Indicates whether the element is active or not. - */ - 'isActive': boolean; - /** - * Indicates whether the element is enable or not. - */ - 'isEnable': boolean; - /** - * Indicates whether the element is hint state or not. - */ - 'isHint': boolean; - /** - * Indicates whether the element is focused or not. - */ - 'isFocused': boolean; - /** - * Indicates whether the element is password or not. - */ - 'isPassword': boolean; - /** - * Indicates whether the element is visible or not. - */ - 'isVisible': boolean; - /** - * Indicates the total count of the items. - */ - 'itemCount': number; - /** - * Indicates the last content. - */ - 'lastContent': string; - /** - * Indicates the display layer of the element. - */ - 'layer': number; - /** - * Indicates whether the element is long clickable. - */ - 'longClickable': boolean; - /** - * Indicates the page id. - */ - 'pageId': number; - /** - * Indicates the parent of the element. - */ - 'parent': AccessibilityElement; - /** - * Indicates whether the element supports multiple lines of text. - */ - 'pluralLineSupported': boolean; - /** - * Indicates the area of the element. - */ - 'rect': Rect; - /** - * Indicates the resource name of the element. - */ - 'resourceName': string; - /** - * Indicates the root element of the window element. - */ - 'rootElement': AccessibilityElement; - /** - * Indicates the display area of the element. - */ - 'screenRect': Rect; - /** - * Indicates whether the element is scrollable. - */ - 'scrollable': boolean; - /** - * Indicates whether the element is selected. - */ - 'selected': boolean; - /** - * Indicates the list index of the first item displayed on the screen. - */ - 'startIndex': number; - /** - * Indicates the text of the element. - */ - 'text': string; - /** - * Indicates the maximum length limit of the element text. - */ - 'textLengthLimit': number; - /** - * Indicates the unit of movement of the element text as it is read. - */ - 'textMoveUnit': accessibility.TextMoveUnit; - /** - * Indicates the action that triggered the element event. - */ - 'triggerAction': accessibility.Action; - /** - * Indicates the window type of the element. - */ - 'type': WindowType; - /** - * Indicates the maximum value. - */ - 'valueMax': number; - /** - * Indicates the minimum value. - */ - 'valueMin': number; - /** - * Indicates the current value. - */ - 'valueNow': number; - /** - * Indicates the window id. - */ - 'windowId': number; -} + /** + * Indicates accessibility focus state. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + accessibilityFocused: boolean; + /** + * Indicates the bundle name to which it belongs. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + bundleName: string; + /** + * Indicates whether the element is checkable. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + checkable: boolean; + /** + * Indicates whether the element is checked. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + checked: boolean; + /** + * Indicates all child elements. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + children: Array; + /** + * Indicates whether the element is clickable. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + clickable: boolean; + /** + * Indicates the component ID to which the element belongs. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + componentId: number; + /** + * Indicates the component type to which the element belongs. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + componentType: string; + /** + * Indicates the content. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + contents: Array; + /** + * Indicates the index of the current item. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + currentIndex: number; + /** + * Indicates the description of the element. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + description: string; + /** + * Indicates whether the element is editable. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + editable: boolean; + /** + * Indicates the list index of the last item displayed on the screen. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + endIndex: number; + /** + * Indicates the string of error state. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + error: string; + /** + * Indicates whether the element is focusable. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + focusable: boolean; + /** + * Indicates the hint text. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + hintText: string; + /** + * Indicates the type of input text. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + inputType: number; + /** + * Indicates the inspector key. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + inspectorKey: string; + /** + * Indicates whether the element is active or not. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + isActive: boolean; + /** + * Indicates whether the element is enable or not. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + isEnable: boolean; + /** + * Indicates whether the element is hint state or not. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + isHint: boolean; + /** + * Indicates whether the element is focused or not. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + isFocused: boolean; + /** + * Indicates whether the element is password or not. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + isPassword: boolean; + /** + * Indicates whether the element is visible or not. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + isVisible: boolean; + /** + * Indicates the total count of the items. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + itemCount: number; + /** + * Indicates the last content. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + lastContent: string; + /** + * Indicates the display layer of the element. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + layer: number; + /** + * Indicates whether the element is long clickable. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + longClickable: boolean; + /** + * Indicates the page id. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + pageId: number; + /** + * Indicates the parent of the element. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + parent: AccessibilityElement; + /** + * Indicates whether the element supports multiple lines of text. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + pluralLineSupported: boolean; + /** + * Indicates the area of the element. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + rect: Rect; + /** + * Indicates the resource name of the element. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + resourceName: string; + /** + * Indicates the root element of the window element. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + rootElement: AccessibilityElement; + /** + * Indicates the display area of the element. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + screenRect: Rect; + /** + * Indicates whether the element is scrollable. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + scrollable: boolean; + /** + * Indicates whether the element is selected. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + selected: boolean; + /** + * Indicates the list index of the first item displayed on the screen. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + startIndex: number; + /** + * Indicates the text of the element. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + text: string; + /** + * Indicates the maximum length limit of the element text. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + textLengthLimit: number; + /** + * Indicates the unit of movement of the element text as it is read. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + textMoveUnit: accessibility.TextMoveUnit; + /** + * Indicates the action that triggered the element event. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + triggerAction: accessibility.Action; + /** + * Indicates the window type of the element. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + type: WindowType; + /** + * Indicates the maximum value. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + valueMax: number; + /** + * Indicates the minimum value. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + valueMin: number; + /** + * Indicates the current value. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + valueNow: number; + /** + * Indicates the window id. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + windowId: number; +}; /** -* Indicates the direction of the search focus. - * @since 9 + * Indicates the direction of the search focus. + * * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 */ type FocusDirection = 'up' | 'down' | 'left' | 'right' | 'forward' | 'backward'; /** * Indicates the type of the focus. - * @since 9 + * * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 */ type FocusType = 'accessibility' | 'normal'; /** * Indicates the type of the window. - * @since 9 + * * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 */ type WindowType = 'application' | 'system'; /** * Indicates rectangle. - * @since 9 + * + * @typedef Rect * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 */ interface Rect { - left: number; - top: number; - width: number; - height: number; + left: number; + top: number; + width: number; + height: number; }