console.info('Succeeded in stoping ServiceExtensionAbility.');
console.info('Succeeded in stopping ServiceExtensionAbility.');
}).catch((err)=>{
}).catch((err)=>{
console.error(`Failed to stop ServiceExtensionAbility. Code is ${err.code}, message is ${err.message}`);
console.error(`Failed to stop ServiceExtensionAbility. Code is ${err.code}, message is ${err.message}`);
})
})
...
@@ -267,7 +267,7 @@ The ServiceExtensionAbility returns an IRemoteObject in the **onConnect()** call
...
@@ -267,7 +267,7 @@ The ServiceExtensionAbility returns an IRemoteObject in the **onConnect()** call
};
};
letoptions={
letoptions={
onConnect(elementName,remote){
onConnect(elementName,remote){
/* The input parameter remote is the object returned by the ServiceExtensionAbility in the onConnect lifecycle callback.
/* remote is the object returned by the ServiceExtensionAbility in the onConnect lifecycle callback.
* This object is used for communication with the ServiceExtensionAbility. For details, see the section below.
* This object is used for communication with the ServiceExtensionAbility. For details, see the section below.
*/
*/
console.info('onConnect callback');
console.info('onConnect callback');
...
@@ -346,7 +346,9 @@ After obtaining the [rpc.RemoteObject](../reference/apis/js-apis-rpc.md#iremoteo
...
@@ -346,7 +346,9 @@ After obtaining the [rpc.RemoteObject](../reference/apis/js-apis-rpc.md#iremoteo
console.info(`onConnect remote is null`);
console.info(`onConnect remote is null`);
return;
return;
}
}
// Directly call the RPC interface to send messages to the server. The client needs to serialize the input parameters and deserialize the return values. The process is complex.
/* Directly call the RPC interface to send messages to the server.
* The client needs to serialize the input parameters and deserialize the return values. The process is complex.
*/
letoption=newrpc.MessageOption();
letoption=newrpc.MessageOption();
letdata=newrpc.MessageSequence();
letdata=newrpc.MessageSequence();
letreply=newrpc.MessageSequence();
letreply=newrpc.MessageSequence();
...
@@ -440,7 +442,9 @@ When a ServiceExtensionAbility is used to provide sensitive services, the client
...
@@ -440,7 +442,9 @@ When a ServiceExtensionAbility is used to provide sensitive services, the client