提交 ca9a1bc0 编写于 作者: X xinking129

fix doc sample

Signed-off-by: Nxinking129 <xinxin13@huawei.com>
上级 69f0a9ed
...@@ -606,13 +606,13 @@ setStaticSubscribeEventState(enable: boolean, callback: AsyncCallback<void>): vo ...@@ -606,13 +606,13 @@ setStaticSubscribeEventState(enable: boolean, callback: AsyncCallback<void>): vo
```ts ```ts
import CommonEventManager from '@ohos.commonEventManager'
CommonEventManager.setStaticSubscribeEventState(true, (err) => { CommonEventManager.setStaticSubscribeEventState(true, (err) => {
if (err) { if (err.code) {
console.info(`Set static subscribe event state failed, errCode: ${err.code}, errMes: ${err.message}`); console.info(`Set static subscribe event state callback failed, errCode: ${err.code}, errMes: ${err.message}`);
return; return;
} }
console.info(`Set static subscribe event state success`); console.info(`Set static subscribe event state callback success`);
}
}); });
``` ```
...@@ -652,9 +652,10 @@ setStaticSubscribeEventState(enable: boolean): Promise<void>; ...@@ -652,9 +652,10 @@ setStaticSubscribeEventState(enable: boolean): Promise<void>;
```ts ```ts
commonEventManager.setStaticSubscribeEventState(true).then(() => { import CommonEventManager from '@ohos.commonEventManager'
console.info(`Set static subscribe event state success`); CommonEventManager.setStaticSubscribeEventState(false).then(() => {
console.info(`Set static subscribe event state promise success`);
}).catch ((err) => { }).catch ((err) => {
console.info(`Set static subscribe event state failed, errCode: ${err.code}, errMes: ${err.message}`); console.info(`Set static subscribe event state promise failed, errCode: ${err.code}, errMes: ${err.message}`);
}); });
``` ```
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册