未验证 提交 48484e6d 编写于 作者: 耿文广 提交者: Gitee

update zh-cn/application-dev/reference/apis/js-apis-freeInstall.md.

Signed-off-by: N耿文广 <gengwenguang@huawei.com>
上级 35b70903
......@@ -136,13 +136,14 @@ setHapModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: Upg
```js
import freeInstall from '@ohos.bundle.freeInstall';
import { BusinessError } from '@ohos.base';
let bundleName = 'com.example.myapplication';
let moduleName = 'entry';
let upgradeFlag = freeInstall.UpgradeFlag.SINGLE_UPGRADE;
try {
freeInstall.setHapModuleUpgradeFlag(bundleName, moduleName, upgradeFlag).then(() => {
console.info('Operation succeed')
}).catch(err => {
}).catch((err: BusinessError) => {
console.error('Operation failed:' + JSON.stringify(err));
});
} catch (err) {
......@@ -236,12 +237,13 @@ isHapModuleRemovable(bundleName: string, moduleName: string): Promise\<boolean>;
```js
import freeInstall from '@ohos.bundle.freeInstall';
import { BusinessError } from '@ohos.base';
let bundleName = 'com.example.myapplication';
let moduleName = 'entry';
try {
freeInstall.isHapModuleRemovable(bundleName, moduleName).then(data => {
console.info('Operation succeed:' + JSON.stringify(data));
}).catch(err => {
}).catch((err: BusinessError) => {
console.error('Operation failed:' + JSON.stringify(err));
});
} catch (err) {
......@@ -332,12 +334,13 @@ getBundlePackInfo(bundleName: string, bundlePackFlag : BundlePackFlag): Promise\
```js
import freeInstall from '@ohos.bundle.freeInstall';
import { BusinessError } from '@ohos.base';
let bundleName = 'com.example.myapplication';
let bundlePackFlag = freeInstall.BundlePackFlag.GET_PACK_INFO_ALL;
try {
freeInstall.getBundlePackInfo(bundleName, bundlePackFlag).then(data => {
console.info('Operation succeed:' + JSON.stringify(data));
}).catch(err => {
}).catch((err: BusinessError) => {
console.error('Operation failed:' + JSON.stringify(err));
});
} catch (err) {
......@@ -402,10 +405,11 @@ getDispatchInfo(): Promise\<DispatchInfo>;
```js
import freeInstall from '@ohos.bundle.freeInstall';
import { BusinessError } from '@ohos.base';
try {
freeInstall.getDispatchInfo().then(data => {
console.info('Operation succeed:' + JSON.stringify(data));
}).catch(err => {
}).catch((err: BusinessError) => {
console.error('Operation failed:' + JSON.stringify(err));
});
} catch (err) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册