提交 ee0424a0 编写于 作者: Z zhanghuiyu_5451

示例代码ArkTS规范整改

Signed-off-by: Nzhanghuiyu <zhanghuiyu9@huawei.com>
上级 a137aadf
...@@ -40,7 +40,7 @@ AccessibilityExtensionAbility为无障碍扩展服务框架,允许三方开发 ...@@ -40,7 +40,7 @@ AccessibilityExtensionAbility为无障碍扩展服务框架,允许三方开发
在已创建工程的ets文件夹下创建AccessibilityExtAbility文件夹,在该文件夹下创建AccessibilityExtAbility.ts文件,在新增的文件中加入以下代码: 在已创建工程的ets文件夹下创建AccessibilityExtAbility文件夹,在该文件夹下创建AccessibilityExtAbility.ts文件,在新增的文件中加入以下代码:
```typescript ```typescript
import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility'; import AccessibilityExtensionAbility, { AccessibilityEvent } from '@ohos.application.AccessibilityExtensionAbility';
class AccessibilityExtAbility extends AccessibilityExtensionAbility { class AccessibilityExtAbility extends AccessibilityExtensionAbility {
onConnect() { onConnect() {
...@@ -51,7 +51,7 @@ class AccessibilityExtAbility extends AccessibilityExtensionAbility { ...@@ -51,7 +51,7 @@ class AccessibilityExtAbility extends AccessibilityExtensionAbility {
console.info('AccessibilityExtAbility onDisconnect'); console.info('AccessibilityExtAbility onDisconnect');
} }
onAccessibilityEvent(accessibilityEvent) { onAccessibilityEvent(accessibilityEvent: AccessibilityEvent) {
console.info('AccessibilityExtAbility onAccessibilityEvent: ' + JSON.stringify(accessibilityEvent)); console.info('AccessibilityExtAbility onAccessibilityEvent: ' + JSON.stringify(accessibilityEvent));
} }
} }
...@@ -72,7 +72,7 @@ export default AccessibilityExtAbility; ...@@ -72,7 +72,7 @@ export default AccessibilityExtAbility;
相关无障碍事件可以在`onAccessibilityEvent()`方法中进行业务逻辑处理,具体事件可参考[AccessibilityEvent](../reference/apis/js-apis-application-accessibilityExtensionAbility.md#accessibilityevent)。此处以事件`pageStateUpdate`为例: 相关无障碍事件可以在`onAccessibilityEvent()`方法中进行业务逻辑处理,具体事件可参考[AccessibilityEvent](../reference/apis/js-apis-application-accessibilityExtensionAbility.md#accessibilityevent)。此处以事件`pageStateUpdate`为例:
```typescript ```typescript
onAccessibilityEvent(accessibilityEvent) { onAccessibilityEvent(accessibilityEvent: AccessibilityEvent) {
console.info('AccessibilityExtAbility onAccessibilityEvent: ' + JSON.stringify(accessibilityEvent)); console.info('AccessibilityExtAbility onAccessibilityEvent: ' + JSON.stringify(accessibilityEvent));
if (accessibilityEvent.eventType === 'pageStateUpdate') { if (accessibilityEvent.eventType === 'pageStateUpdate') {
console.info('AccessibilityExtAbility onAccessibilityEvent: pageStateUpdate'); console.info('AccessibilityExtAbility onAccessibilityEvent: pageStateUpdate');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册