js-apis-accessibility.md 22.0 KB
Newer Older
E
esterzhou 已提交
1 2
# Accessibility

3
> **NOTE**<br>
E
esterzhou 已提交
4 5 6 7 8 9 10 11 12 13 14 15 16 17
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.

## Modules to Import

```typescript
import accessibility from '@ohos.accessibility';
```

## AbilityState

Enumerates the states of an accessibility application.

**System capability**: SystemCapability.Barrierfree.Accessibility.Core

18 19 20 21 22
 | Name | Description |
 | -------- | -------- |
 | enable | The accessibility application is enabled. |
 | disable | The accessibility application is disabled. |
 | install | The accessibility application has been installed. |
E
esterzhou 已提交
23 24 25 26 27 28 29

## AbilityType

Enumerates the types of accessibility applications.

**System capability**: SystemCapability.Barrierfree.Accessibility.Core

30 31 32 33 34 35 36
 | Name | Description |
 | -------- | -------- |
 | audible | The accessibility application provides audible feedback. |
 | generic | The accessibility application provides generic feedback. |
 | haptic | The accessibility application provides haptic feedback. |
 | spoken | The accessibility application provides spoken feedback. |
 | visual | The accessibility application provides visual feedback. |
E
esterzhou 已提交
37 38 39 40 41 42 43 44 45

## AccessibilityAbilityInfo

Provides information about an accessibility application.

**System capability**: SystemCapability.Barrierfree.Accessibility.Core

### Attributes

46 47 48 49 50 51 52 53 54
 | Name | Type | Readable | Writable | Description |
 | -------- | -------- | -------- | -------- | -------- |
 | id | number | Yes | No | Ability ID. |
 | name | string | Yes | No | Ability name. |
 | bundleName | string | Yes | No | Bundle name. |
 | abilityTypes | Array&lt;[AbilityType](#abilitytype)&gt; | Yes | No | Accessibility application type. |
 | capabilities | Array&lt;[Capability](#capability)&gt; | Yes | No | Capabilities list of the accessibility application. |
 | description | string | Yes | No | Description of the accessibility application. |
 | eventTypes | Array&lt;[EventType](#eventtype)&gt; | Yes | No | List of events that the accessibility application focuses on. |
E
esterzhou 已提交
55 56 57 58 59 60 61

## Action

Describes the target action supported by an accessibility application.

**System capability**: SystemCapability.Barrierfree.Accessibility.Core

62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
 | Name | Description |
 | -------- | -------- |
 | click | Clicking. |
 | longClick | Long pressing. |
 | scrollForward | Scrolling forward. |
 | scrollBackward | Scrolling backward. |
 | focus | Obtaining focus. |
 | clearFocus | Clearing focus. |
 | clearSelection | Clearing selection. |
 | accessibilityFocus | Obtaining the accessibility focus. |
 | clearAccessibilityFocus | Clearing the accessibility focus. |
 | cut | Cut. |
 | copy | Copy. |
 | paste | Paste. |
 | select | Select. |
 | setText | Setting the text. |
 | delete | Delete. |
 | setSelection | Setting the selection. |
E
esterzhou 已提交
80 81 82 83 84 85 86

## Capability

Enumerates the capabilities of an auxiliary application.

**System capability**: SystemCapability.Barrierfree.Accessibility.Core

87 88 89 90 91 92 93
 | Name | Description |
 | -------- | -------- |
 | retrieve | Capability to retrieve the window content. |
 | touchGuide | Capability of touch guide mode. |
 | keyEventObserver | Capability to filter key events. |
 | zoom | Capability to control the display zoom level. |
 | gesture | Capability to perform gesture actions. |
E
esterzhou 已提交
94 95 96 97 98 99 100

## CaptionsFontEdgeType<sup>8+</sup>

Enumerates the caption font edge type.

**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing

101 102 103 104 105 106 107
 | Name | Description |
 | -------- | -------- |
 | none | No effect. |
 | raised | Raised effect. |
 | depressed | Depressed effect. |
 | uniform | Uniform effect. |
 | dropShadow | Drop shadow effect. |
E
esterzhou 已提交
108 109 110 111 112 113 114

## CaptionsFontFamily<sup>8+</sup>

Enumerates the caption font families.

**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing

115 116 117 118 119 120 121 122 123 124
 | Name | Description |
 | -------- | -------- |
 | default | Default font family. |
 | monospacedSerif | Monospaced Serif fonts, which use the same width for each character. |
 | serif | Serif fonts. |
 | monospacedSansSerif | Monospaced Sans Serif fonts, which use the same width for each character. |
 | sansSerif | Sans Serif fonts. |
 | casual | Casual fonts. |
 | cursive | Cursive fonts. |
 | smallCapitals | Small caps fonts. |
E
esterzhou 已提交
125 126 127 128 129 130 131

## CaptionsStyle<sup>8+</sup>

Describes the caption style.

**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing

132 133 134 135 136 137 138 139
 | Name | Type | Readable | Writable | Description |
 | -------- | -------- | -------- | -------- | -------- |
 | fontFamily | [CaptionsFontFamily](#captionsfontfamily8) | Yes | No | Font family of the captions. |
 | fontScale | number | Yes | No | Font scale of the captions. |
 | fontColor | number \ | string | Yes | No | Font color of the captions. |
 | fontEdgeType | [CaptionsFontEdgeType](#captionsfontedgetype8) | Yes | No | Font edge type of the captions. |
 | backgroundColor | number \ | string | Yes | No | Background color of the captions. |
 | windowColor | number \ | string | Yes | No | Window color of the captions. |
E
esterzhou 已提交
140 141 142 143 144 145 146

## CaptionsManager<sup>8+</sup>

Implements caption configuration management.

### Attributes

147 148 149 150
 | Name | Type | Readable | Writable | Description |
 | -------- | -------- | -------- | -------- | -------- |
 | enabled | boolean | Yes | No | Whether to enable caption configuration. |
 | style | [CaptionsStyle](#captionsstyle8) | Yes | No | Caption style. |
E
esterzhou 已提交
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165

### Methods

In the following API examples, you must first use the [accessibility.getCaptionsManager()](#accessibilitygetcaptionsmanager8) method to obtain a **captionsManager** instance, and then call the methods using the obtained instance.

#### on('enableChange')

on(type: 'enableChange', callback: Callback&lt;boolean&gt;): void;

Enables listening for enable status changes of caption configuration.

**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing

- **Parameters**

166 167 168 169
 | Name | Type | Mandatory | Description |
 | -------- | -------- | -------- | -------- |
 | type | string | Yes | Type of the event to listen for, which is set to **enableChange** in this API. |
 | callback | Callback&lt;boolean&gt; | Yes | Callback invoked when the enable status of caption configuration changes. |
E
esterzhou 已提交
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188

- Example

  ```typescript
  captionsManager.on('enableChange',(data) => {
      console.info('success data:subscribeStateObserver : ' + JSON.stringify(data))
  })
  ```

#### on('styleChange')

on(type: 'styleChange', callback: Callback&lt;CaptionsStyle&gt;): void;

Enables listening for caption style changes.

**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing

- **Parameters**

189 190 191 192
 | Name | Type | Mandatory | Description |
 | -------- | -------- | -------- | -------- |
 | type | string | Yes | Type of the event to listen for, which is set to **styleChange** in this API. |
 | callback | Callback&lt;[CaptionsStyle](#captionsstyle8)&gt; | Yes | Callback invoked when the caption style changes. |
E
esterzhou 已提交
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211

- Example

  ```typescript
  captionsManager.on('styleChange',(data) => {
      console.info('success data:subscribeStateObserver : ' + JSON.stringify(data))
  })
  ```
  
#### off('enableChange')

off(type: 'enableChange', callback?: Callback&lt;boolean&gt;): void;

Disables listening for enable status changes of caption configuration.

**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing

- **Parameters**

212 213 214 215
 | Name | Type | Mandatory | Description |
 | -------- | -------- | -------- | -------- |
 | type | string | Yes | Type of the event to listen for, which is set to **enableChange** in this API. |
 | callback | Callback&lt;boolean&gt; | No | Callback invoked when the enable status of caption configuration changes. |
E
esterzhou 已提交
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232

- Example

  ```typescript
  captionsManager.off('enableChange')
  ```

#### off('styleChange')

off(type: 'styleChange', callback?: Callback&lt;CaptionsStyle&gt;): void;

Disables listening for caption style changes.s is removed.

**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing

- **Parameters**

233 234 235 236
 | Name | Type | Mandatory | Description |
 | -------- | -------- | -------- | -------- |
 | type | string | Yes | Type of the event to listen for, which is set to **styleChange** in this API. |
 | callback | Callback&lt;[CaptionsStyle](#captionsstyle8)&gt; | No | Callback invoked when the caption style changes. |
E
esterzhou 已提交
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251

- Example

  ```typescript
  captionsManager.off('styleChange')
  ```

## EventInfo

Describes a GUI change event.

**System capability**: SystemCapability.Barrierfree.Accessibility.Core

### Attributes

252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
 | Name | Type | Readable | Writable | Description |
 | -------- | -------- | -------- | -------- | -------- |
 | type | [EventType](#eventtype) | Yes | Yes | Accessibility event type. |
 | windowUpdateType | [WindowUpdateType](#windowupdatetype) | Yes | Yes | Window update type. |
 | bundleName | string | Yes | Yes | Target application name. |
 | componentType | string | Yes | Yes | Type of the event source component, for example, button or chart. |
 | pageId | number | Yes | Yes | Page ID of the event source. |
 | description | string | Yes | Yes | Event description. |
 | triggerAction | [Action](#action) | Yes | Yes | Action that triggers the event. |
 | textMoveUnit | [TextMoveUnit](#textmoveunit) | Yes | Yes | Text movement unit. |
 | contents | Array&lt;string&gt; | Yes | Yes | Array of contents. |
 | lastContent | string | Yes | Yes | Latest content. |
 | beginIndex | number | Yes | Yes | Sequence number of the first item displayed on the page. |
 | currentIndex | number | Yes | Yes | Sequence number of the current item. |
 | endIndex | number | Yes | Yes | Sequence number of the last item displayed on the page. |
 | itemCount | number | Yes | Yes | Total number of items. |
E
esterzhou 已提交
268 269 270 271 272 273 274

## EventType

Enumerates accessibility event types.

**System capability**: SystemCapability.Barrierfree.Accessibility.Core

275 276 277 278 279 280 281 282 283 284 285 286 287
 | Name | Description |
 | -------- | -------- |
 | click | Event of clicking a component. |
 | longClick | Event of long-pressing a component. |
 | select | Event of selecting a component. |
 | focus | Event indicating that the component obtains the focus. |
 | textUpdate | Event indicating that the component text has been updated. |
 | hoverEnter | Event indicating that the hover enters a component. |
 | hoverExit | Event indicating that the hover exits a component. |
 | scroll | Event of the scroll view. |
 | textSelectionUpdate | Event indicating that the selected text has been updated. |
 | accessibilityFocus | Event indicating that the accessibility focus has been obtained. |
 | accessibilityFocusClear | Event indicating that the accessibility focus has been cleared. |
E
esterzhou 已提交
288 289 290 291 292 293 294

## TextMoveUnit

Enumerates the movement units for traversing the node text.

**System capability**: SystemCapability.Barrierfree.Accessibility.Core

295 296 297 298 299 300 301
 | Name | Description |
 | -------- | -------- |
 | char | The movement unit for traversing the node text is by character. |
 | word | The movement unit for traversing the node text is by word. |
 | line | The movement unit for traversing the node text is by line. |
 | page | The movement unit for traversing the node text is by page. |
 | paragraph | The movement unit for traversing the node text is by paragraph. |
E
esterzhou 已提交
302 303 304 305 306 307 308

## WindowUpdateType

Enumerates window update types.

**System capability**: SystemCapability.Barrierfree.Accessibility.Core

309 310 311 312 313 314 315 316 317 318 319 320 321
 | Name | Description |
 | -------- | -------- |
 | add | Window adding. |
 | remove | Window deletion. |
 | title | Window title change. |
 | bounds | Window boundary change. |
 | layer | Window layer change. |
 | active | Window activity change. |
 | focus | Window focus change. |
 | accessibilityFocus | Window accessibility focus change. |
 | parent | Parent window change. |
 | children | Child window change. |
 | pip | Picture-in-picture (PIP) mode change. |
E
esterzhou 已提交
322 323 324 325 326 327 328 329 330 331 332

## accessibility.getAbilityLists

getAbilityLists(abilityType: AbilityType, stateType: AbilityState): Promise&lt;Array&lt;AccessibilityAbilityInfo&gt;&gt;

Obtains the accessibility application list. This API uses a promise to return the result.

**System capability**: SystemCapability.Barrierfree.Accessibility.Core

- **Parameters**

333 334 335 336
 | Name | Type | Mandatory | Description |
 | -------- | -------- | -------- | -------- |
 | abilityType | [AbilityType](#abilitytype) | Yes | Accessibility application type. |
 | stateType | [AbilityState](#abilitystate) | Yes | Accessibility application status. |
E
esterzhou 已提交
337 338 339

- Return value

340 341 342
 | Type | Description |
 | -------- | -------- |
 | Promise&lt;Array&lt;[AccessibilityAbilityInfo](#accessibilityabilityinfo)&gt;&gt; | Promise used to return the accessibility application list. |
E
esterzhou 已提交
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375

- Example

  ```typescript
  accessibility.getAbilityLists("spoken", "enable")
      .then((data) => {
          console.info('success data:getAbilityList1 : ' + JSON.stringify(data));
          for (let item of data) {
              console.info(item.id);
              console.info(item.name);
              console.info(item.description);
              console.info(item.abilityTypes);
              console.info(item.eventTypes);
              console.info(item.capabilities);
              console.info(item.packageName);
              console.info(item.filterBundleNames);
              console.info(item.bundleName);
          }
      }).catch((error) => {
          console.error('failed to  getAbilityList1 because ' + JSON.stringify(error));
      })
  ```

## accessibility.getAbilityLists

getAbilityLists(abilityType: AbilityType, stateType: AbilityState,callback: AsyncCallback&lt;Array&lt;AccessibilityAbilityInfo&gt;&gt;): void

Obtains the accessibility application list. This API uses an asynchronous callback to return the result.

**System capability**: SystemCapability.Barrierfree.Accessibility.Core

- **Parameters**

376 377 378 379 380
 | Name | Type | Mandatory | Description |
 | -------- | -------- | -------- | -------- |
 | abilityType | [AbilityType](#abilitytype) | Yes | Accessibility application type. |
 | stateType | [AbilityState](#abilitystate) | Yes | Accessibility application status. |
 | callback | AsyncCallback&lt;Array&lt;[AccessibilityAbilityInfo](#accessibilityabilityinfo)&gt;&gt; | Yes | Callback used to return the accessibility application list. |
E
esterzhou 已提交
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414

- Example

  ```typescript
  accessibility.getAbilityLists("visual", "enable", (err, data) => {
      if (err) {
          console.error('failed to getAbilityList2 because ' + JSON.stringify(err));
          return;
      }
      console.info('success data:getAbilityList2 : ' + JSON.stringify(data));
      for (let item of data) {
          console.info(item.id);
          console.info(item.name);
          console.info(item.description);
          console.info(item.abilityTypes);
          console.info(item.eventTypes);
          console.info(item.capabilities);
          console.info(item.packageName);
          console.info(item.filterBundleNames);
          console.info(item.bundleName);
      }
  })
  ```

## accessibility.getCaptionsManager<sup>8+</sup>

getCaptionsManager(): CaptionsManager

Obtains the accessibility caption configuration.

**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing

- Return value

415 416 417
 | Type | Description |
 | -------- | -------- |
 | [CaptionsManager](#captionsmanager8) | Accessibility caption configuration. |
E
esterzhou 已提交
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432

- Example

  ```typescript
  captionsManager = accessibility.getCaptionsManager()
  ```

## accessibility.on('accessibilityStateChange' | 'touchGuideStateChange')

on(type: 'accessibilityStateChange' | 'touchGuideStateChange', callback: Callback&lt;boolean&gt;): void

Enables listening for the accessibility application or touch guide mode status changes. 

- **Parameters**

433 434 435 436
 | Name | Type | Mandatory | Description |
 | -------- | -------- | -------- | -------- |
 | type | string | Yes | Type of the event to listen for.<br>-&nbsp;**accessibilityStateChange** means to listen for enable status changes of the accessibility application.<br>**System capability**: SystemCapability.Barrierfree.Accessibility.Core<br>-&nbsp;**touchGuideStateChange** means to listen for enable status changes of the touch guide mode.<br>**System capability**: SystemCapability.Barrierfree.Accessibility.Vision |
 | callback | Callback&lt;boolean&gt; | Yes | Callback invoked when the enable status changes. |
E
esterzhou 已提交
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455

- Example

  ```typescript
  accessibility.on('accessibilityStateChange',(data) => { 
      console.info('success data:subscribeStateObserver : ' + JSON.stringify(data))
  })
  ```

## accessibility.off('accessibilityStateChange' | 'touchGuideStateChange')

off(type: 'accessibilityStateChange ' | 'touchGuideStateChange', callback?: Callback&lt;boolean&gt;): void

Disables listening for the accessibility application or touch guide mode status changes.

 

- **Parameters**

456 457 458 459
 | Name | Type | Mandatory | Description |
 | -------- | -------- | -------- | -------- |
 | type |  string | No | Type of the event to listen for.<br>-&nbsp;**accessibilityStateChange** means to listen for enable status changes of the accessibility application.<br>**System capability**: SystemCapability.Barrierfree.Accessibility.Core<br>-&nbsp;**touchGuideStateChange** means to listen for enable status changes of the touch guide mode.<br>**System capability**: SystemCapability.Barrierfree.Accessibility.Vision |
 | callback | Callback&lt;boolean&gt; | No | Callback invoked when the enable status changes. |
E
esterzhou 已提交
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478

- Example

  ```typescript
  accessibility.off('accessibilityStateChange',(data) => {
      console.info('success data:unSubscribeStateObserver : ' + JSON.stringify(data))
  })
  ```

## accessibility.isOpenAccessibility

isOpenAccessibility(): Promise&lt;boolean&gt;

Checks whether accessibility is enabled. This API uses a promise to return the result.

**System capability**: SystemCapability.Barrierfree.Accessibility.Core

- Return value

479 480 481
 | Type | Description |
 | -------- | -------- |
 | Promise&lt;boolean&gt; | Returns **true** if accessibility is enabled; returns **false** otherwise. |
E
esterzhou 已提交
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503

- Example

  ```typescript
  accessibility.isOpenAccessibility()
      .then((data) => {
          console.info('success data:isOpenAccessibility : ' + JSON.stringify(data))
      }).catch((error) => {
          console.error('failed to  isOpenAccessibility because ' + JSON.stringify(error));
      })
  ```

## accessibility.isOpenAccessibility

isOpenAccessibility(callback: AsyncCallback&lt;boolean&gt;): void

Checks whether accessibility is enabled. This API uses an asynchronous callback to return the result.

**System capability**: SystemCapability.Barrierfree.Accessibility.Core

- Parameters

504 505 506
 | Name | Type | Mandatory | Description |
 | -------- | -------- | -------- | -------- |
 | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. Returns **true** if accessibility is enabled; returns **false** otherwise. |
E
esterzhou 已提交
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529

- Example

  ```typescript
  accessibility.isOpenAccessibility((err, data) => {
      if (err) {
          console.error('failed to isOpenAccessibility because ' + JSON.stringify(err));
          return;
      }
      console.info('success data:isOpenAccessibility : ' + JSON.stringify(data))
  })
  ```

## accessibility.isOpenTouchGuide

isOpenTouchGuide(): Promise&lt;boolean&gt;

Checks whether touch guide mode is enabled. This API uses a promise to return the result.

**System capability**: SystemCapability.Barrierfree.Accessibility.Core

- Return value

530 531 532
 | Type | Description |
 | -------- | -------- |
 | Promise&lt;boolean&gt; | Returns **true** if touch guide mode is enabled; returns **false** otherwise. |
E
esterzhou 已提交
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554

- Example

  ```typescript
  accessibility.isOpenTouchGuide()
      .then((data) => {
          console.info('success data:isOpenTouchGuide : ' + JSON.stringify(data))
      }).catch((error) => {
          console.error('failed to  isOpenTouchGuide because ' + JSON.stringify(error));
      })
  ```

## accessibility.isOpenTouchGuide

isOpenTouchGuide(callback: AsyncCallback&lt;boolean&gt;): void

Checks whether touch guide mode is enabled. This API uses an asynchronous callback to return the result.

**System capability**: SystemCapability.Barrierfree.Accessibility.Core

- Parameters

555 556 557
 | Name | Type | Mandatory | Description |
 | -------- | -------- | -------- | -------- |
 | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. Returns **true** if touch guide mode is enabled; returns **false** otherwise. |
E
esterzhou 已提交
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580

- Example

  ```typescript
  accessibility.isOpenTouchGuide((err, data) => {
      if (err) {
          console.error('failed to isOpenTouchGuide because ' + JSON.stringify(err));
          return;
      }
      console.info('success data:isOpenTouchGuide : ' + JSON.stringify(data))
  })
  ```

## accessibility.sendEvent

sendEvent(event: EventInfo): Promise&lt;void&gt;

Sends an accessibility event. This API uses a promise to return the result.

**System capability**: SystemCapability.Barrierfree.Accessibility.Core

- **Parameters**

581 582 583
 | Name | Type | Mandatory | Description |
 | -------- | -------- | -------- | -------- |
 | event | [EventInfo](#eventinfo) | Yes | Accessibility event. |
E
esterzhou 已提交
584 585 586

- Return value

587 588 589
 | Type | Description |
 | -------- | -------- |
 | Promise&lt;void&gt; | Promise used to return the result. Returns data if the accessibility event is sent successfully; returns an error otherwise. |
E
esterzhou 已提交
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611

- Example

  ```typescript
  accessibility.sendEvent(this.eventInfo)
      .then((data) => {
          console.info('success data:sendEvent : ' + JSON.stringify(data))
      }).catch((error) => {
          console.error('failed to  sendEvent because ' + JSON.stringify(error));
      })
  ```

## accessibility.sendEvent

sendEvent(event: EventInfo, callback: AsyncCallback&lt;void&gt;): void

Sends an accessibility event. This API uses an asynchronous callback to return the result.

**System capability**: SystemCapability.Barrierfree.Accessibility.Core

- **Parameters**

612 613 614 615
 | Name | Type | Mandatory | Description |
 | -------- | -------- | -------- | -------- |
 | event | [EventInfo](#eventinfo) | Yes | Accessibility event. |
 | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. Returns data if the accessibility event is sent successfully; returns an error otherwise. |
E
esterzhou 已提交
616 617 618 619 620 621 622 623 624 625 626 627

- Example

  ```typescript
  accessibility.sendEvent(this.eventInfo,(err, data) => {
      if (err) {
          console.error('failed to sendEvent because ' + JSON.stringify(err));
          return;
      }   
      console.info('success data:sendEvent : ' + JSON.stringify(data))
  })
  ```