未验证 提交 35f40311 编写于 作者: 耿文广 提交者: Gitee

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

Signed-off-by: N耿文广 <gengwenguang@huawei.com>
上级 a6cf2017
...@@ -34,7 +34,6 @@ SystemCapability.BundleManager.BundleFramework ...@@ -34,7 +34,6 @@ SystemCapability.BundleManager.BundleFramework
**示例:** **示例:**
```ts ```ts
import bundle from '@ohos.bundle';
import bundleInstall from '@ohos.bundle.installer'; import bundleInstall from '@ohos.bundle.installer';
import { BusinessError } from '@ohos.base'; import { BusinessError } from '@ohos.base';
...@@ -45,8 +44,8 @@ let installParam: bundleInstall.InstallParam = { ...@@ -45,8 +44,8 @@ let installParam: bundleInstall.InstallParam = {
installFlag: 1, installFlag: 1,
}; };
bundle.getBundleInstaller().then(installer: bundleInstall.BundleInstaller => { bundleInstall.getBundleInstaller().then(installer => {
installer.install(hapFilePaths, installParam, err: BusinessError => { installer.install(hapFilePaths, installParam, err => {
if (err) { if (err) {
console.error('install failed:' + JSON.stringify(err)); console.error('install failed:' + JSON.stringify(err));
} else { } else {
...@@ -88,7 +87,6 @@ SystemCapability.BundleManager.BundleFramework ...@@ -88,7 +87,6 @@ SystemCapability.BundleManager.BundleFramework
**示例:** **示例:**
```ts ```ts
import bundle from '@ohos.bundle';
import bundleInstall from '@ohos.bundle.installer'; import bundleInstall from '@ohos.bundle.installer';
import { BusinessError } from '@ohos.base'; import { BusinessError } from '@ohos.base';
...@@ -99,15 +97,15 @@ let installParam: bundleInstall.InstallParam = { ...@@ -99,15 +97,15 @@ let installParam: bundleInstall.InstallParam = {
installFlag: 1, installFlag: 1,
}; };
bundle.getBundleInstaller().then(installer: bundleInstall.BundleInstaller => { bundleInstall.getBundleInstaller().then(installer => {
installer.uninstall(bundleName, installParam, err: BusinessError => { installer.uninstall(bundleName, installParam, err => {
if (err) { if (err) {
console.error('uninstall failed:' + JSON.stringify(err)); console.error('uninstall failed:' + JSON.stringify(err));
} else { } else {
console.info('uninstall successfully.'); console.info('uninstall successfully.');
} }
}); });
}).catch(error => { }).catch((error: BusinessError) => {
let message = (error as BusinessError).message; let message = (error as BusinessError).message;
console.error('getBundleInstaller failed. Cause: ' + message); console.error('getBundleInstaller failed. Cause: ' + message);
}); });
...@@ -141,7 +139,6 @@ SystemCapability.BundleManager.BundleFramework ...@@ -141,7 +139,6 @@ SystemCapability.BundleManager.BundleFramework
**示例:** **示例:**
```ts ```ts
import bundle from '@ohos.bundle';
import bundleInstall from '@ohos.bundle.installer'; import bundleInstall from '@ohos.bundle.installer';
import { BusinessError } from '@ohos.base'; import { BusinessError } from '@ohos.base';
...@@ -152,15 +149,15 @@ let installParam: bundleInstall.InstallParam = { ...@@ -152,15 +149,15 @@ let installParam: bundleInstall.InstallParam = {
installFlag: 1, installFlag: 1,
}; };
bundle.getBundleInstaller().then(installer: bundleInstall.BundleInstaller => { bundleInstall.getBundleInstaller().then(installer => {
installer.recover(bundleName, installParam, err: BusinessError => { installer.uninstall(bundleName, installParam, err => {
if (err) { if (err) {
console.error('recover failed:' + JSON.stringify(err)); console.error('uninstall failed:' + JSON.stringify(err));
} else { } else {
console.info('recover successfully.'); console.info('uninstall successfully.');
} }
}); });
}).catch(error => { }).catch((error: BusinessError) => {
let message = (error as BusinessError).message; let message = (error as BusinessError).message;
console.error('getBundleInstaller failed. Cause: ' + message); console.error('getBundleInstaller failed. Cause: ' + message);
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册