提交 528064a7 编写于 作者: X xujie

stage模式获取context方式

Signed-off-by: Nxujie <xujie223@huawei.com>
上级 6f3c6136
...@@ -47,6 +47,19 @@ FA模型示例: ...@@ -47,6 +47,19 @@ FA模型示例:
Stage模型示例: Stage模型示例:
```ts
// 获取context
import UIAbility from '@ohos.app.ability.UIAbility';
class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage){
globalThis.context = this.context;
}
}
let context = globalThis.context;
VpnConnection = vpn.createVpnConnection(context);
console.info("vpn onInit: " + JSON.stringify(VpnConnection));
```
## VpnConnection.setUp<sup>10+</sup> ## VpnConnection.setUp<sup>10+</sup>
setUp(config: VpnConfig, callback: AsyncCallback\<number\>): void; setUp(config: VpnConfig, callback: AsyncCallback\<number\>): void;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册