未验证 提交 69c02c65 编写于 作者: O openharmony_ci 提交者: Gitee

!1620 修改老的文档示例代码

Merge pull request !1620 from 刘宝/master
...@@ -63,7 +63,7 @@ getOrCreateLocalDir(): Promise\<string> ...@@ -63,7 +63,7 @@ getOrCreateLocalDir(): Promise\<string>
```js ```js
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext(); var context = featureAbility.getContext();
context.getOrCreateLocalDir().then((void) => { context.getOrCreateLocalDir().then(() => {
console.info("==========================>getOrCreateLocalDirCallback=======================>"); console.info("==========================>getOrCreateLocalDirCallback=======================>");
}); });
``` ```
...@@ -91,9 +91,9 @@ verifyPermission(permission: string, options: PermissionOptions, callback: Async ...@@ -91,9 +91,9 @@ verifyPermission(permission: string, options: PermissionOptions, callback: Async
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
import bundle from '@ohos.bundle' import bundle from '@ohos.bundle'
var context = featureAbility.getContext(); var context = featureAbility.getContext();
var datainfo = await bundle.getBundleInfo('com.context.test',1); bundle.getBundleInfo('com.context.test', 1, (datainfo) =>{
context.verifyPermission("com.example.permission",datainfo.uid) context.verifyPermission("com.example.permission", datainfo.uid);
});
``` ```
...@@ -146,7 +146,7 @@ verifyPermission(permission: string, options?: PermissionOptions): Promise\<numb ...@@ -146,7 +146,7 @@ verifyPermission(permission: string, options?: PermissionOptions): Promise\<numb
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext(); var context = featureAbility.getContext();
var Permission = context.PermissionOptions(1,1); var Permission = context.PermissionOptions(1,1);
context.getOrCreateLocalDir('com.context.permission',Permission).then((void) => { context.getOrCreateLocalDir('com.context.permission',Permission).then(() => {
console.info("==========================>verifyPermissionCallback=======================>"); console.info("==========================>verifyPermissionCallback=======================>");
}); });
``` ```
...@@ -223,7 +223,7 @@ getApplicationInfo(): Promise\<ApplicationInfo> ...@@ -223,7 +223,7 @@ getApplicationInfo(): Promise\<ApplicationInfo>
```js ```js
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext(); var context = featureAbility.getContext();
context.getApplicationInfo().then((void) => { context.getApplicationInfo().then(() => {
console.info("==========================>getApplicationInfoCallback=======================>"); console.info("==========================>getApplicationInfoCallback=======================>");
}); });
``` ```
...@@ -269,7 +269,7 @@ getBundleName(): Promise\<string> ...@@ -269,7 +269,7 @@ getBundleName(): Promise\<string>
```js ```js
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext(); var context = featureAbility.getContext();
context.getBundleName().then((void) => { context.getBundleName().then(() => {
console.info("==========================>getBundleNameCallback=======================>"); console.info("==========================>getBundleNameCallback=======================>");
}); });
``` ```
...@@ -315,7 +315,7 @@ getProcessInfo(): Promise\<ProcessInfo> ...@@ -315,7 +315,7 @@ getProcessInfo(): Promise\<ProcessInfo>
```js ```js
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext(); var context = featureAbility.getContext();
context.getProcessInfo().then((void) => { context.getProcessInfo().then(() => {
console.info("==========================>getProcessInfoCallback=======================>"); console.info("==========================>getProcessInfoCallback=======================>");
}); });
``` ```
...@@ -365,7 +365,7 @@ getElementName(): Promise\<ElementName> ...@@ -365,7 +365,7 @@ getElementName(): Promise\<ElementName>
```js ```js
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext(); var context = featureAbility.getContext();
context.getElementName().then((void) => { context.getElementName().then(() => {
console.info("==========================>getElementNameCallback=======================>"); console.info("==========================>getElementNameCallback=======================>");
}); });
``` ```
...@@ -407,7 +407,7 @@ getProcessName(): Promise\<string> ...@@ -407,7 +407,7 @@ getProcessName(): Promise\<string>
```js ```js
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext(); var context = featureAbility.getContext();
context.getProcessName().then((void) => { context.getProcessName().then(() => {
console.info("==========================>getProcessNameCallback=======================>"); console.info("==========================>getProcessNameCallback=======================>");
}); });
``` ```
...@@ -453,7 +453,7 @@ getCallingBundle(): Promise\<string> ...@@ -453,7 +453,7 @@ getCallingBundle(): Promise\<string>
```js ```js
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext(); var context = featureAbility.getContext();
context.getCallingBundle().then((void) => { context.getCallingBundle().then(() => {
console.info("==========================>getCallingBundleCallback=======================>"); console.info("==========================>getCallingBundleCallback=======================>");
}); });
``` ```
......
...@@ -27,7 +27,6 @@ getId(uri: string): number ...@@ -27,7 +27,6 @@ getId(uri: string): number
**示例:** **示例:**
```js ```js
import dataUriUtils from '@ohos.ability.datauriutils'
dataUriUtils.getIdSync("com.example.dataUriUtils/1221") dataUriUtils.getIdSync("com.example.dataUriUtils/1221")
``` ```
...@@ -55,10 +54,9 @@ attachId(uri: string, id: number): string ...@@ -55,10 +54,9 @@ attachId(uri: string, id: number): string
**示例:** **示例:**
```js ```js
import dataUriUtils from '@ohos.ability.datauriutils'
var idint = 1122; var idint = 1122;
dataUriUtils.attachId( dataUriUtils.attachId(
"com.example.dataUriUtils" "com.example.dataUriUtils",
idint, idint,
) )
``` ```
...@@ -85,7 +83,6 @@ deleteId(uri: string): string ...@@ -85,7 +83,6 @@ deleteId(uri: string): string
**示例:** **示例:**
```js ```js
import dataUriUtils from '@ohos.ability.datauriutils'
dataUriUtils.deleteId("com.example.dataUriUtils/1221") dataUriUtils.deleteId("com.example.dataUriUtils/1221")
``` ```
...@@ -112,11 +109,10 @@ updateId(uri: string, id: number): string ...@@ -112,11 +109,10 @@ updateId(uri: string, id: number): string
**示例:** **示例:**
```js ```js
import dataUriUtils from '@ohos.ability.datauriutils'
var idint = 1122; var idint = 1122;
dataUriUtils.updateId( dataUriUtils.updateId(
"com.example.dataUriUtils" "com.example.dataUriUtils",
idint, idint
) )
``` ```
...@@ -137,8 +137,8 @@ terminateSelf(callback: AsyncCallback&lt;void&gt;): void; ...@@ -137,8 +137,8 @@ terminateSelf(callback: AsyncCallback&lt;void&gt;): void;
- 示例: - 示例:
``` ```
this.context.terminateSelf((err) => { this.context.terminateSelf((err) => {
console.log('terminateSelf result:' + JSON.stringfy(err); console.log('terminateSelf result:' + JSON.stringfy(err));
} });
``` ```
...@@ -157,7 +157,7 @@ terminateSelf(): Promise&lt;void&gt;; ...@@ -157,7 +157,7 @@ terminateSelf(): Promise&lt;void&gt;;
``` ```
this.context.terminateSelf(want).then((data) => { this.context.terminateSelf(want).then((data) => {
console.log('success:' + JSON.stringfy(data)); console.log('success:' + JSON.stringfy(data));
)).catch((error) => { }).catch((error) => {
console.log('failed:' + JSON.stringfy(error)); console.log('failed:' + JSON.stringfy(error));
}); });
``` ```
......
...@@ -65,8 +65,8 @@ var DAHelper = featureAbility.acquireDataAbilityHelper( ...@@ -65,8 +65,8 @@ var DAHelper = featureAbility.acquireDataAbilityHelper(
); );
var mode = "rwt"; var mode = "rwt";
DAHelper.openFile( DAHelper.openFile(
"dataability:///com.example.DataAbility" "dataability:///com.example.DataAbility",
mode).then((void) => { mode).then((data) => {
console.info("==========================>openFileCallback=======================>"); console.info("==========================>openFileCallback=======================>");
}); });
``` ```
...@@ -338,7 +338,7 @@ var DAHelper = featureAbility.acquireDataAbilityHelper( ...@@ -338,7 +338,7 @@ var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility" "dataability:///com.example.DataAbility"
); );
DAHelper.denormalizeUri( DAHelper.denormalizeUri(
"dataability:///com.example.DataAbility",, "dataability:///com.example.DataAbility",
(err, data) => { (err, data) => {
console.info("==========================>Called=======================>"); console.info("==========================>Called=======================>");
}); });
...@@ -398,7 +398,7 @@ var helper = featureAbility.acquireDataAbilityHelper( ...@@ -398,7 +398,7 @@ var helper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility" "dataability:///com.example.DataAbility"
); );
helper.notifyChange( helper.notifyChange(
"dataability:///com.example.DataAbility",, "dataability:///com.example.DataAbility",
(err) => { (err) => {
console.info("==========================>Called=======================>"); console.info("==========================>Called=======================>");
}); });
...@@ -430,7 +430,7 @@ var DAHelper = featureAbility.acquireDataAbilityHelper( ...@@ -430,7 +430,7 @@ var DAHelper = featureAbility.acquireDataAbilityHelper(
); );
DAHelper.notifyChange( DAHelper.notifyChange(
"dataability:///com.example.DataAbility", "dataability:///com.example.DataAbility",
).then((void) => { ).then(() => {
console.info("==========================>notifyChangeCallback=======================>"); console.info("==========================>notifyChangeCallback=======================>");
}); });
``` ```
...@@ -747,7 +747,7 @@ import ohos_data_ability from '@ohos.data.dataability' ...@@ -747,7 +747,7 @@ import ohos_data_ability from '@ohos.data.dataability'
var DAHelper = featureAbility.acquireDataAbilityHelper( var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility" "dataability:///com.example.DataAbility"
); );
var cars=new Array({"value1"}, {"value2"}, {"value3"}, {"value4"}); var cars=new Array("value1", "value2", "value3", "value4");
let da = new ohos_data_ability.DataAbilityPredicates() let da = new ohos_data_ability.DataAbilityPredicates()
DAHelper.query( DAHelper.query(
"dataability:///com.example.DataAbility", "dataability:///com.example.DataAbility",
...@@ -787,7 +787,7 @@ import ohos_data_ability from '@ohos.data.dataability' ...@@ -787,7 +787,7 @@ import ohos_data_ability from '@ohos.data.dataability'
var DAHelper = featureAbility.acquireDataAbilityHelper( var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility" "dataability:///com.example.DataAbility"
); );
var cars=new Array({"value1"}, {"value2"}, {"value3"}, {"value4"}); var cars=new Array("value1", "value2", "value3", "value4");
let da = new ohos_data_ability.DataAbilityPredicates() let da = new ohos_data_ability.DataAbilityPredicates()
DAHelper.query( DAHelper.query(
"dataability:///com.example.DataAbility", "dataability:///com.example.DataAbility",
......
...@@ -28,6 +28,7 @@ startAbility(parameter: StartAbilityParameter, callback: AsyncCallback\<void>: v ...@@ -28,6 +28,7 @@ startAbility(parameter: StartAbilityParameter, callback: AsyncCallback\<void>: v
```js ```js
import particleAbility from '@ohos.ability.particleAbility' import particleAbility from '@ohos.ability.particleAbility'
import wantConstant from "@ohos.ability.wantConstant"
particleAbility.startAbility( particleAbility.startAbility(
{ {
want: want:
...@@ -35,7 +36,7 @@ particleAbility.startAbility( ...@@ -35,7 +36,7 @@ particleAbility.startAbility(
action: "action.system.home", action: "action.system.home",
entities: ["entity.system.home"], entities: ["entity.system.home"],
type: "MIMETYPE", type: "MIMETYPE",
flags: FLAG_AUTH_READ_URI_PERMISSION; flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
deviceId: "", deviceId: "",
bundleName: "com.example.Data", bundleName: "com.example.Data",
abilityName: "com.example.Data.MainAbility", abilityName: "com.example.Data.MainAbility",
...@@ -70,6 +71,7 @@ startAbility(parameter: StartAbilityParameter): Promise\<number> ...@@ -70,6 +71,7 @@ startAbility(parameter: StartAbilityParameter): Promise\<number>
```js ```js
import particleAbility from '@ohos.ability.particleAbility' import particleAbility from '@ohos.ability.particleAbility'
import wantConstant from "@ohos.ability.wantConstant"
particleAbility.startAbility( particleAbility.startAbility(
{ {
want: want:
...@@ -77,14 +79,14 @@ particleAbility.startAbility( ...@@ -77,14 +79,14 @@ particleAbility.startAbility(
action: "action.system.home", action: "action.system.home",
entities: ["entity.system.home"], entities: ["entity.system.home"],
type: "MIMETYPE", type: "MIMETYPE",
flags: FLAG_AUTH_READ_URI_PERMISSION; flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
deviceId: "", deviceId: "",
bundleName: "com.example.Data", bundleName: "com.example.Data",
abilityName: "com.example.Data.MainAbility", abilityName: "com.example. Data.MainAbility",
uri:"" uri:""
}, },
}, },
).then((void) => { ).then(() => {
console.info("particleAbility startAbility"); console.info("particleAbility startAbility");
}); });
``` ```
...@@ -131,7 +133,7 @@ terminateSelf(): Promise\<void> ...@@ -131,7 +133,7 @@ terminateSelf(): Promise\<void>
```js ```js
import particleAbility from '@ohos.ability.particleAbility' import particleAbility from '@ohos.ability.particleAbility'
particleAbility.terminateSelf().then((void) => { particleAbility.terminateSelf().then(() => {
console.info("particleAbility terminateSelf"); console.info("particleAbility terminateSelf");
}); });
``` ```
...@@ -195,7 +197,7 @@ connectAbility(request: Want, options:ConnectOptions): number ...@@ -195,7 +197,7 @@ connectAbility(request: Want, options:ConnectOptions): number
```javascript ```javascript
import particleAbility from '@ohos.ability.particleAbility' import particleAbility from '@ohos.ability.particleAbility'
function onConnectCallback(element, remote){ function onConnectCallback(element, remote){
console.log('ConnectAbility onConnect remote is proxy:' + (remote instanceof rpc.RemoteProxy)); console.log('ConnectAbility onConnectCallback');
} }
function onDisconnectCallback(element){ function onDisconnectCallback(element){
console.log('ConnectAbility onDisconnect element.deviceId : ' + element.deviceId) console.log('ConnectAbility onDisconnect element.deviceId : ' + element.deviceId)
...@@ -234,7 +236,7 @@ disconnectAbility(connection: number, callback:AsyncCallback\<void>): void ...@@ -234,7 +236,7 @@ disconnectAbility(connection: number, callback:AsyncCallback\<void>): void
```javascript ```javascript
import particleAbility from '@ohos.ability.particleAbility' import particleAbility from '@ohos.ability.particleAbility'
function onConnectCallback(element, remote){ function onConnectCallback(element, remote){
console.log('ConnectAbility onConnect remote is proxy:' + (remote instanceof rpc.RemoteProxy)); console.log('ConnectAbility onConnectCallback');
} }
function onDisconnectCallback(element){ function onDisconnectCallback(element){
console.log('ConnectAbility onDisconnect element.deviceId : ' + element.deviceId) console.log('ConnectAbility onDisconnect element.deviceId : ' + element.deviceId)
...@@ -255,8 +257,8 @@ var connId = particleAbility.connectAbility( ...@@ -255,8 +257,8 @@ var connId = particleAbility.connectAbility(
); );
var result = particleAbility.disconnectAbility(connId, var result = particleAbility.disconnectAbility(connId,
(error,data) => { (error,data) => {
console.log('particleAbilityTest DisConnectAbility result errCode : ' + error.code + " data: " + data) console.log('particleAbilityTest DisConnectAbility result errCode : ' + error.code + " data: " + data);
}, }
); );
``` ```
...@@ -282,7 +284,7 @@ disconnectAbility(connection: number): Promise\<void> ...@@ -282,7 +284,7 @@ disconnectAbility(connection: number): Promise\<void>
```javascript ```javascript
import particleAbility from '@ohos.ability.particleAbility' import particleAbility from '@ohos.ability.particleAbility'
function onConnectCallback(element, remote){ function onConnectCallback(element, remote){
console.log('ConnectAbility onConnect remote is proxy:' + (remote instanceof rpc.RemoteProxy)); console.log('ConnectAbility onConnect onConnectCallback');
} }
function onDisconnectCallback(element){ function onDisconnectCallback(element){
console.log('ConnectAbility onDisconnect element.deviceId : ' + element.deviceId) console.log('ConnectAbility onDisconnect element.deviceId : ' + element.deviceId)
...@@ -301,7 +303,7 @@ var connId = particleAbility.connectAbility( ...@@ -301,7 +303,7 @@ var connId = particleAbility.connectAbility(
onFailed: onFailedCallback, onFailed: onFailedCallback,
}, },
); );
var result = particleAbility.disconnectAbility(connId).then((void) => { var result = particleAbility.disconnectAbility(connId).then(() => {
console.info("particleAbilityTest disconnectAbility"); console.info("particleAbilityTest disconnectAbility");
}); });
``` ```
......
...@@ -29,8 +29,8 @@ startAbility(want: Want, callback: AsyncCallback&lt;void&gt;): void; ...@@ -29,8 +29,8 @@ startAbility(want: Want, callback: AsyncCallback&lt;void&gt;): void;
"abilityName": "com.example.myapp.MyAbility" "abilityName": "com.example.myapp.MyAbility"
}; };
this.context.startAbility(want, (err) => { this.context.startAbility(want, (err) => {
console.log('startAbility result:' + JSON.stringfy(err); console.log('startAbility result:' + JSON.stringfy(err));
} });
``` ```
...@@ -58,7 +58,7 @@ startAbility(want: Want): Promise&lt;void&gt;; ...@@ -58,7 +58,7 @@ startAbility(want: Want): Promise&lt;void&gt;;
}; };
this.context.startAbility(want).then((data) => { this.context.startAbility(want).then((data) => {
console.log('success:' + JSON.stringfy(data)); console.log('success:' + JSON.stringfy(data));
)).catch((error) => { }).catch((error) => {
console.log('failed:' + JSON.stringfy(error)); console.log('failed:' + JSON.stringfy(error));
}); });
``` ```
...@@ -78,8 +78,8 @@ terminateSelf(callback: AsyncCallback&lt;void&gt;): void; ...@@ -78,8 +78,8 @@ terminateSelf(callback: AsyncCallback&lt;void&gt;): void;
- 示例: - 示例:
``` ```
this.context.terminateSelf((err) => { this.context.terminateSelf((err) => {
console.log('terminateSelf result:' + JSON.stringfy(err); console.log('terminateSelf result:' + JSON.stringfy(err));
} });
``` ```
...@@ -98,7 +98,7 @@ terminateSelf(): Promise&lt;void&gt;; ...@@ -98,7 +98,7 @@ terminateSelf(): Promise&lt;void&gt;;
``` ```
this.context.terminateSelf(want).then((data) => { this.context.terminateSelf(want).then((data) => {
console.log('success:' + JSON.stringfy(data)); console.log('success:' + JSON.stringfy(data));
)).catch((error) => { }).catch((error) => {
console.log('failed:' + JSON.stringfy(error)); console.log('failed:' + JSON.stringfy(error));
}); });
``` ```
...@@ -128,8 +128,8 @@ connectAbility(want: Want, options: ConnectOptions): number; ...@@ -128,8 +128,8 @@ connectAbility(want: Want, options: ConnectOptions): number;
"abilityName": "com.example.myapp.MyAbility" "abilityName": "com.example.myapp.MyAbility"
}; };
let options = { let options = {
onConnect: function(elementName, proxy) {} onConnect: function(elementName, proxy) {},
onDisConnect: function(elementName) {} onDisConnect: function(elementName) {},
onFailed: function(code) {} onFailed: function(code) {}
} }
let connection = this.context.connectAbility(want,options); let connection = this.context.connectAbility(want,options);
...@@ -151,8 +151,8 @@ disconnectAbility(connection: number, callback:AsyncCallback&lt;void&gt;): void; ...@@ -151,8 +151,8 @@ disconnectAbility(connection: number, callback:AsyncCallback&lt;void&gt;): void;
- 示例: - 示例:
``` ```
this.context.disconnectAbility(connection, (err) => { // connection为connectAbility中的返回值 this.context.disconnectAbility(connection, (err) => { // connection为connectAbility中的返回值
console.log('terminateSelf result:' + JSON.stringfy(err); console.log('terminateSelf result:' + JSON.stringfy(err));
} });
``` ```
...@@ -176,7 +176,7 @@ disconnectAbility(connection: number): Promise&lt;void&gt;; ...@@ -176,7 +176,7 @@ disconnectAbility(connection: number): Promise&lt;void&gt;;
``` ```
this.context.disconnectAbility(connection).then((data) => { // connection为connectAbility中的返回值 this.context.disconnectAbility(connection).then((data) => { // connection为connectAbility中的返回值
console.log('success:' + JSON.stringfy(data)); console.log('success:' + JSON.stringfy(data));
)).catch((error) => { }).catch((error) => {
console.log('failed:' + JSON.stringfy(error)); console.log('failed:' + JSON.stringfy(error));
}); });
``` ```
......
...@@ -39,8 +39,10 @@ Extension生命周期回调,在创建时回调,执行初始化业务逻辑 ...@@ -39,8 +39,10 @@ Extension生命周期回调,在创建时回调,执行初始化业务逻辑
- 示例: - 示例:
``` ```
onCreate(want) { class ServiceExt extends ServiceExtension {
onCreate(want) {
console.log('onCreate, want:' + want.abilityName); console.log('onCreate, want:' + want.abilityName);
}
} }
``` ```
...@@ -53,9 +55,10 @@ Extension生命周期回调,在销毁时回调,执行资源清理等操作 ...@@ -53,9 +55,10 @@ Extension生命周期回调,在销毁时回调,执行资源清理等操作
- 示例: - 示例:
``` ```
onDestroy() { class ServiceExt extends ServiceExtension {
onDestroy() {
console.log('onDestroy'); console.log('onDestroy');
destory(); }
} }
``` ```
...@@ -74,8 +77,10 @@ Extension生命周期回调,如果是startAbility拉起的服务,会在onCre ...@@ -74,8 +77,10 @@ Extension生命周期回调,如果是startAbility拉起的服务,会在onCre
- 示例: - 示例:
``` ```
onRequest(want: Want, startId: number) { class ServiceExt extends ServiceExtension {
onRequest(want, startId) {
console.log('onRequest, want:' + want.abilityName); console.log('onRequest, want:' + want.abilityName);
}
} }
``` ```
...@@ -106,10 +111,11 @@ Extension生命周期回调,如果是connectAbility拉起的服务,会在onC ...@@ -106,10 +111,11 @@ Extension生命周期回调,如果是connectAbility拉起的服务,会在onC
onRemoteRequest(code, data, reply, option) { onRemoteRequest(code, data, reply, option) {
} }
} }
... class ServiceExt extends ServiceExtension {
onConnect(want) { onConnect(want) {
console.log('onConnect , want:' + want.abilityName); console.log('onConnect , want:' + want.abilityName);
return new StubTest("test"); return new StubTest("test");
}
} }
``` ```
...@@ -127,7 +133,9 @@ Extension的生命周期,断开服务连接时回调。 ...@@ -127,7 +133,9 @@ Extension的生命周期,断开服务连接时回调。
- 示例: - 示例:
``` ```
onDisconnect(want) { class ServiceExt extends ServiceExtension {
onDisconnect(want) {
console.log('onDisconnect, want:' + want.abilityName); console.log('onDisconnect, want:' + want.abilityName);
}
} }
``` ```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册