1e41f4b71Sopenharmony_ci# @ohos.application.StaticSubscriberExtensionAbility (StaticSubscriberExtensionAbility)
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciStaticSubscriberExtensionAbility模块提供静态订阅者ExtensionAbility类别的能力。
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci> **说明:**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
8e41f4b71Sopenharmony_ci>
9e41f4b71Sopenharmony_ci> 本模块接口仅可在Stage模型下使用。
10e41f4b71Sopenharmony_ci>
11e41f4b71Sopenharmony_ci> 本模块接口均为系统接口。
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci## 导入模块
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci```ts
16e41f4b71Sopenharmony_ciimport { StaticSubscriberExtensionAbility } from '@kit.BasicServicesKit';
17e41f4b71Sopenharmony_ci```
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci## 属性
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci**系统API**:该接口为系统接口,三方应用不支持调用。
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci| 名称    | 类型                                                         | 只读 | 可选 | 说明     |
26e41f4b71Sopenharmony_ci| ------- | ------------------------------------------------------------ | ---- | ---- | -------- |
27e41f4b71Sopenharmony_ci| context<sup>10+</sup> | [StaticSubscriberExtensionContext](js-apis-application-StaticSubscriberExtensionContext-sys.md) | 否   | 否   | 上下文。 |
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci## StaticSubscriberExtensionAbility.onReceiveEvent
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_cionReceiveEvent(event: CommonEventData): void;
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci静态订阅者通用事件回调。
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci**系统API**:该接口为系统接口,三方应用不支持调用。
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ci**参数:**
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 |
42e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- |
43e41f4b71Sopenharmony_ci| event | [CommonEventData](./js-apis-inner-commonEvent-commonEventData.md) | 是 | 静态订阅者通用事件回调。 |
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ci**示例:**
46e41f4b71Sopenharmony_ci  ```ts
47e41f4b71Sopenharmony_ci  import { commonEventManager, StaticSubscriberExtensionAbility } from '@kit.BasicServicesKit';
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ci    class MyStaticSubscriberExtensionAbility extends StaticSubscriberExtensionAbility {
50e41f4b71Sopenharmony_ci        onReceiveEvent(event: commonEventManager.CommonEventData) {
51e41f4b71Sopenharmony_ci            console.log(`onReceiveEvent, event: ${JSON.stringify(event)}`);
52e41f4b71Sopenharmony_ci        }
53e41f4b71Sopenharmony_ci    }
54e41f4b71Sopenharmony_ci  ```