提交 f4571477 编写于 作者: L libaoping

fix:Add proxy definition to rpc sample code

Signed-off-by: Nlibaoping <libaoping1@huawei.com>
上级 9b12b139
...@@ -21,6 +21,26 @@ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: Me ...@@ -21,6 +21,26 @@ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: Me
``` ```
import rpc from "@ohos.rpc" import rpc from "@ohos.rpc"
import FA from "@ohos.ability.featureAbility";
let proxy;
let connect = {
onConnect: function(elementName, remoteProxy) {
console.log("RpcClient: js onConnect called.");
proxy = remoteProxy;
},
onDisconnect: function(elementName) {
console.log("RpcClient: onDisconnect");
},
onFailed: function() {
console.log("RpcClient: onFailed");
}
};
let want = {
"bundleName": "com.ohos.server",
"abilityName": "com.ohos.server.MainAbility",
};
FA.connectAbility(want, connect);
let option = new rpc.MessageOption() let option = new rpc.MessageOption()
let data = rpc.MessageParcel.create() let data = rpc.MessageParcel.create()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册