提交 d46730e1 编写于 作者: G geng-wenguang

arkts 告警修复

Signed-off-by: Ngeng-wenguang <gengwenguang@huawei.com>
上级 7e6af2a2
......@@ -50,6 +50,8 @@ setDisposedStatus(appId: string, disposedWant: Want): Promise\<void>
**示例:**
```ts
import { BusinessError } from '@ohos.base';
let appId = "com.example.myapplication_xxxxx";
let want = {bundleName: 'com.example.myapplication'};
......@@ -58,10 +60,12 @@ try {
.then(() => {
console.info('setDisposedStatus success');
}).catch((error) => {
console.error('setDisposedStatus failed ' + error.message);
let message = (err as BusinessError).message;
console.error('setDisposedStatus failed ' + message);
});
} catch (error) {
console.error('setDisposedStatus failed ' + error.message);
let message = (err as BusinessError).message;
console.error('setDisposedStatus failed ' + message);
}
```
......@@ -96,19 +100,24 @@ setDisposedStatus(appId: string, disposedWant: Want, callback: AsyncCallback\<vo
**示例:**
```ts
import appControl from '@ohos.bundle.appControl';
import { BusinessError } from '@ohos.base';
let appId = "com.example.myapplication_xxxxx";
let want = {bundleName: 'com.example.myapplication'};
try {
appControl.setDisposedStatus(appId, want, (error, data) => {
appControl.setDisposedStatus(appId, want, (error: BusinessError, data: appControl.AsyncCallback) => {
if (error) {
console.error('setDisposedStatus failed ' + error.message);
let message = (error as BusinessError).message;
console.error('setDisposedStatus failed ' + message);
return;
}
console.info('setDisposedStatus success');
});
} catch (error) {
console.error('setDisposedStatus failed ' + error.message);
let message = (err as BusinessError).message;
console.error('setDisposedStatus failed ' + message);
}
```
......@@ -143,6 +152,7 @@ setDisposedStatusSync(appId: string, disposedWant: Want): void;
```ts
import appControl from '@ohos.bundle.appControl';
import { BusinessError } from '@ohos.base';
import Want from '@ohos.app.ability.Want';
let appId: string = "com.example.myapplication_xxxxx";
......@@ -151,7 +161,8 @@ let want: Want = {bundleName: 'com.example.myapplication'};
try {
appControl.setDisposedStatusSync(appId, want);
} catch (error) {
console.error('setDisposedStatusSync failed ' + error.message);
let message = (error as BusinessError).message;
console.error('setDisposedStatusSync failed ' + message);
}
```
......@@ -190,17 +201,22 @@ getDisposedStatus(appId: string): Promise\<Want>;
**示例:**
```ts
import appControl from '@ohos.bundle.appControl';
import { BusinessError } from '@ohos.base';
let appId = "com.example.myapplication_xxxxx";
try {
appControl.getDisposedStatus(appId)
.then((data) => {
.then((data: appControl.AsyncCallback) => {
console.info('getDisposedStatus success. DisposedStatus: ' + JSON.stringify(data));
}).catch((error) => {
console.error('getDisposedStatus failed ' + error.message);
let message = (error as BusinessError).message;
console.error('getDisposedStatus failed ' + message);
});
} catch (error) {
console.error('getDisposedStatus failed ' + error.message);
let message = (error as BusinessError).message;
console.error('getDisposedStatus failed ' + message);
}
```
......@@ -234,18 +250,23 @@ getDisposedStatus(appId: string, callback: AsyncCallback\<Want>): void;
**示例:**
```ts
import appControl from '@ohos.bundle.appControl';
import { BusinessError } from '@ohos.base';
let appId = "com.example.myapplication_xxxxx";
try {
appControl.getDisposedStatus(appId, (error, data) => {
appControl.getDisposedStatus(appId, (error, data: appControl.AsyncCallback) => {
if (error) {
console.error('getDisposedStatus failed ' + error.message);
let message = (error as BusinessError).message;
console.error('getDisposedStatus failed ' + message);
return;
}
console.info('getDisposedStatus success. DisposedStatus: ' + JSON.stringify(data));
});
} catch (error) {
console.error('getDisposedStatus failed ' + error.message);
let message = (error as BusinessError).message;
console.error('getDisposedStatus failed ' + message);
}
```
......@@ -285,15 +306,17 @@ getDisposedStatusSync(appId: string): Want;
```ts
import appControl from '@ohos.bundle.appControl';
import { BusinessError } from '@ohos.base';
import Want from '@ohos.app.ability.Want';
let appId: string = "com.example.myapplication_xxxxx";
let want: Want;
try {
want = appControl.getDisposedStatusSync(appId);
want = appControl.getDisposedStatusSync(appId);
} catch (error) {
console.error('getDisposedStatusSync failed ' + error.message);
let message = (error as BusinessError).message;
console.error('getDisposedStatusSync failed ' + message);
}
```
......@@ -332,6 +355,8 @@ deleteDisposedStatus(appId: string): Promise\<void>
**示例:**
```ts
import { BusinessError } from '@ohos.base';
let appId = "com.example.myapplication_xxxxx";
try {
......@@ -339,10 +364,12 @@ try {
.then(() => {
console.info('deleteDisposedStatus success');
}).catch((error) => {
console.error('deleteDisposedStatus failed ' + error.message);
let message = (error as BusinessError).message;
console.error('deleteDisposedStatus failed ' + message);
});
} catch (error) {
console.error('deleteDisposedStatus failed ' + error.message);
let message = (error as BusinessError).message;
console.error('deleteDisposedStatus failed ' + message);
}
```
......@@ -376,9 +403,12 @@ deleteDisposedStatus(appId: string, callback: AsyncCallback\<void>) : void
**示例:**
```ts
import appControl from '@ohos.bundle.appControl';
import { BusinessError } from '@ohos.base';
let appId = "com.example.myapplication_xxxxx";
try {
appControl.deleteDisposedStatus(appId, (error, data) => {
appControl.deleteDisposedStatus(appId, (error: BusinessError, data: appControl.AsyncCallback) => {
if (error) {
console.error('deleteDisposedStatus failed ' + error.message);
return;
......@@ -386,7 +416,8 @@ try {
console.info('deleteDisposedStatus success');
});
} catch (error) {
console.error('deleteDisposedStatus failed ' + error.message);
let message = (error as BusinessError).message;
console.error('deleteDisposedStatus failed ' + message);
}
```
......@@ -420,13 +451,15 @@ deleteDisposedStatusSync(appId: string) : void
```ts
import appControl from '@ohos.bundle.appControl';
import { BusinessError } from '@ohos.base';
let appId: string = "com.example.myapplication_xxxxx";
try {
appControl.deleteDisposedStatusSync(appId);
} catch (error) {
console.error('deleteDisposedStatusSync failed ' + error.message);
let message = (error as BusinessError).message;
console.error('deleteDisposedStatusSync failed ' + message);
}
```
......@@ -438,18 +471,22 @@ appId是应用的唯一标识,由应用Bundle名称和签名信息决定,可
```ts
import bundleManager from '@ohos.bundle.bundleManager';
import appControl from '@ohos.bundle.appControl';
import { BusinessError } from '@ohos.base';
let bundleName = 'com.example.myapplication';
let appId: string;
try {
bundleManager.getBundleInfo(bundleName, bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO)
.then((data) => {
.then((data: appControl.AsyncCallback) => {
appId = data.signatureInfo.appId;
console.info("appId is " + appId);
}).catch((error) => {
console.error("getBundleInfo failed " + error.message);
let message = (error as BusinessError).message;
console.error("getBundleInfo failed " + message);
});
} catch (error) {
console.error("getBundleInfo failed " + error.message);
let message = (error as BusinessError).message;
console.error("getBundleInfo failed " + message);
}
```
\ No newline at end of file
......@@ -35,15 +35,18 @@ SystemCapability.BundleManager.BundleFramework
```ts
import bundle from '@ohos.bundle';
let hapFilePaths = ['/data/storage/el2/base/haps/entry/files/'];
let installParam = {
import bundleInstall from '@ohos.bundle.installer';
import { BusinessError } from '@ohos.base';
let hapFilePaths: Array<string> = ['/data/storage/el2/base/haps/entry/files/'];
let installParam: bundleInstall.InstallParam = {
userId: 100,
isKeepData: false,
installFlag: 1,
};
bundle.getBundleInstaller().then(installer => {
installer.install(hapFilePaths, installParam, err => {
bundle.getBundleInstaller().then(installer: bundleInstall.BundleInstaller => {
installer.install(hapFilePaths, installParam, err: BusinessError => {
if (err) {
console.error('install failed:' + JSON.stringify(err));
} else {
......@@ -51,7 +54,8 @@ bundle.getBundleInstaller().then(installer => {
}
});
}).catch(error => {
console.error('getBundleInstaller failed. Cause: ' + error.message);
let message = (error as BusinessError).message;
console.error('getBundleInstaller failed. Cause: ' + message);
});
```
......@@ -85,15 +89,18 @@ SystemCapability.BundleManager.BundleFramework
```ts
import bundle from '@ohos.bundle';
let bundleName = 'com.example.myapplication';
let installParam = {
import bundleInstall from '@ohos.bundle.installer';
import { BusinessError } from '@ohos.base';
let bundleName: string = 'com.example.myapplication';
let installParam: bundleInstall.InstallParam = {
userId: 100,
isKeepData: false,
installFlag: 1,
};
bundle.getBundleInstaller().then(installer => {
installer.uninstall(bundleName, installParam, err => {
bundle.getBundleInstaller().then(installer: bundleInstall.BundleInstaller => {
installer.uninstall(bundleName, installParam, err: BusinessError => {
if (err) {
console.error('uninstall failed:' + JSON.stringify(err));
} else {
......@@ -101,7 +108,8 @@ bundle.getBundleInstaller().then(installer => {
}
});
}).catch(error => {
console.error('getBundleInstaller failed. Cause: ' + error.message);
let message = (error as BusinessError).message;
console.error('getBundleInstaller failed. Cause: ' + message);
});
```
## BundleInstaller.recover<sup>(deprecated)<sup>
......@@ -134,16 +142,18 @@ SystemCapability.BundleManager.BundleFramework
```ts
import bundle from '@ohos.bundle';
import bundleInstall from '@ohos.bundle.installer';
import { BusinessError } from '@ohos.base';
let bundleName = 'com.example.myapplication';
let installParam = {
let bundleName: string = 'com.example.myapplication';
let installParam: bundleInstall.InstallParam = {
userId: 100,
isKeepData: false,
installFlag: 1,
};
bundle.getBundleInstaller().then(installer => {
installer.recover(bundleName, installParam, err => {
bundle.getBundleInstaller().then(installer: bundleInstall.BundleInstaller => {
installer.recover(bundleName, installParam, err: BusinessError => {
if (err) {
console.error('recover failed:' + JSON.stringify(err));
} else {
......@@ -151,7 +161,8 @@ bundle.getBundleInstaller().then(installer => {
}
});
}).catch(error => {
console.error('getBundleInstaller failed. Cause: ' + error.message);
let message = (error as BusinessError).message;
console.error('getBundleInstaller failed. Cause: ' + message);
});
```
......
......@@ -64,7 +64,7 @@ isDefaultApplication(type: string): Promise\<boolean>
```ts
import defaultAppMgr from '@ohos.bundle.defaultAppManager';
defaultAppMgr.isDefaultApplication(defaultAppMgr.ApplicationType.BROWSER)
.then((data) => {
.then((data: defaultAppMgr.AsyncCallback<boolean>) => {
console.info('Operation successful. IsDefaultApplication ? ' + JSON.stringify(data));
}).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
......@@ -90,7 +90,9 @@ isDefaultApplication(type: string, callback: AsyncCallback\<boolean>): void
```ts
import defaultAppMgr from '@ohos.bundle.defaultAppManager';
defaultAppMgr.isDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, (err, data) => {
import { BusinessError } from '@ohos.base';
defaultAppMgr.isDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, (err: BusinessError, data: defaultAppMgr.AsyncCallback<boolean>) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
......@@ -125,7 +127,7 @@ isDefaultApplicationSync(type: string): boolean;
```ts
import defaultAppMgr from '@ohos.bundle.defaultAppManager';
defaultAppMgr.isDefaultApplicationSync(defaultAppMgr.ApplicationType.BROWSER)
.then((data) => {
.then((data: defaultAppMgr.AsyncCallback<boolean>) => {
console.info('Operation successful. IsDefaultApplicationSync ? ' + JSON.stringify(data));
}).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
......@@ -172,7 +174,7 @@ getDefaultApplication(type: string, userId?: number): Promise\<BundleInfo>
```ts
import defaultAppMgr from '@ohos.bundle.defaultAppManager';
defaultAppMgr.getDefaultApplication(defaultAppMgr.ApplicationType.BROWSER)
.then((data) => {
.then((data: defaultAppMgr.AsyncCallback<BundleInfo>) => {
console.info('Operation successful. bundleInfo: ' + JSON.stringify(data));
})
.catch((error) => {
......@@ -180,7 +182,7 @@ defaultAppMgr.getDefaultApplication(defaultAppMgr.ApplicationType.BROWSER)
});
defaultAppMgr.getDefaultApplication("image/png")
.then((data) => {
.then((data: defaultAppMgr.AsyncCallback<BundleInfo>) => {
console.info('Operation successful. bundleInfo: ' + JSON.stringify(data));
})
.catch((error) => {
......@@ -222,8 +224,10 @@ getDefaultApplication(type: string, userId: number, callback: AsyncCallback\<Bun
```ts
import defaultAppMgr from '@ohos.bundle.defaultAppManager';
import { BusinessError } from '@ohos.base';
let userId = 100;
defaultAppMgr.getDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, userId, (err, data) => {
defaultAppMgr.getDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, userId, (err: BusinessError, data: defaultAppMgr.AsyncCallback<BundleInfo>) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
......@@ -231,7 +235,7 @@ defaultAppMgr.getDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, userI
console.info('Operation successful. bundleInfo:' + JSON.stringify(data));
});
defaultAppMgr.getDefaultApplication("image/png", userId, (err, data) => {
defaultAppMgr.getDefaultApplication("image/png", userId, (err: BusinessError, data: defaultAppMgr.AsyncCallback<BundleInfo>) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
......@@ -272,14 +276,16 @@ getDefaultApplication(type: string, callback: AsyncCallback\<BundleInfo>) : void
```ts
import defaultAppMgr from '@ohos.bundle.defaultAppManager';
defaultAppMgr.getDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, (err, data) => {
import { BusinessError } from '@ohos.base';
defaultAppMgr.getDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, (err: BusinessError, data: defaultAppMgr.AsyncCallback<BundleInfo>) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
}
console.info('Operation successful. bundleInfo:' + JSON.stringify(data));
});
defaultAppMgr.getDefaultApplication("image/png", (err, data) => {
defaultAppMgr.getDefaultApplication("image/png", (err: BusinessError, data: defaultAppMgr.AsyncCallback<BundleInfo>) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
......@@ -328,7 +334,7 @@ getDefaultApplicationSync(type: string, userId?: number): BundleInfo;
```ts
import defaultAppMgr from '@ohos.bundle.defaultAppManager';
defaultAppMgr.getDefaultApplicationSync(defaultAppMgr.ApplicationType.BROWSER)
.then((data) => {
.then((data: defaultAppMgr.AsyncCallback<BundleInfo>) => {
console.info('Operation successful. bundleInfo: ' + JSON.stringify(data));
})
.catch((error) => {
......@@ -336,7 +342,7 @@ defaultAppMgr.getDefaultApplicationSync(defaultAppMgr.ApplicationType.BROWSER)
});
defaultAppMgr.getDefaultApplicationSync("image/png")
.then((data) => {
.then((data: defaultAppMgr.AsyncCallback<BundleInfo>) => {
console.info('Operation successful. bundleInfo: ' + JSON.stringify(data));
})
.catch((error) => {
......@@ -384,32 +390,25 @@ setDefaultApplication(type: string, elementName: ElementName, userId?: number):
```ts
import defaultAppMgr from '@ohos.bundle.defaultAppManager';
defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, {
let info: defaultAppMgr.ElementName = {
bundleName: "com.example.myapplication",
moduleName: "module01",
abilityName: "EntryAbility"
}).then((data) => {
}
defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, info).then((data: defaultAppMgr.AsyncCallback<void>) => {
console.info('Operation successful.');
}).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
});
let userId = 100;
defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, {
bundleName: "com.example.myapplication",
moduleName: "module01",
abilityName: "EntryAbility"
}, userId).then((data) => {
defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, info, userId).then((data: defaultAppMgr.AsyncCallback<void>) => {
console.info('Operation successful.');
}).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
});
defaultAppMgr.setDefaultApplication("image/png", {
bundleName: "com.example.myapplication",
moduleName: "module01",
abilityName: "EntryAbility"
}, userId).then((data) => {
defaultAppMgr.setDefaultApplication("image/png", info, userId).then((data: defaultAppMgr.AsyncCallback<void>) => {
console.info('Operation successful.');
}).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
......@@ -451,12 +450,15 @@ setDefaultApplication(type: string, elementName: ElementName, userId: number, ca
```ts
import defaultAppMgr from '@ohos.bundle.defaultAppManager';
import { BusinessError } from '@ohos.base';
let userId = 100;
defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, {
let info: defaultAppMgr.ElementName = {
bundleName: "com.example.myapplication",
moduleName: "module01",
abilityName: "EntryAbility"
}, userId, (err, data) => {
}
defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, info, userId, (errerr: BusinessError, data: defaultAppMgr.AsyncCallback<BundleInfo>) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
......@@ -464,11 +466,7 @@ defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, {
console.info('Operation successful.');
});
defaultAppMgr.setDefaultApplication("image/png", {
bundleName: "com.example.myapplication",
moduleName: "module01",
abilityName: "EntryAbility"
}, userId, (err, data) => {
defaultAppMgr.setDefaultApplication("image/png", info, userId, (errerr: BusinessError, data: defaultAppMgr.AsyncCallback<BundleInfo>) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
......@@ -510,11 +508,14 @@ setDefaultApplication(type: string, elementName: ElementName, callback: AsyncCal
```ts
import defaultAppMgr from '@ohos.bundle.defaultAppManager';
defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, {
import { BusinessError } from '@ohos.base';
let info: defaultAppMgr.ElementName = {
bundleName: "com.example.myapplication",
moduleName: "module01",
abilityName: "EntryAbility"
}, (err, data) => {
}
defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, info, (err: BusinessError, data: defaultAppMgr.AsyncCallback<BundleInfo>) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
......@@ -522,11 +523,7 @@ defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, {
console.info('Operation successful.');
});
defaultAppMgr.setDefaultApplication("image/png", {
bundleName: "com.example.myapplication",
moduleName: "module01",
abilityName: "EntryAbility"
}, (err, data) => {
defaultAppMgr.setDefaultApplication("image/png", info, (err: BusinessError, data: defaultAppMgr.AsyncCallback<BundleInfo>) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
......@@ -569,32 +566,25 @@ setDefaultApplicationSync(type: string, elementName: ElementName, userId?: numbe
```ts
import defaultAppMgr from '@ohos.bundle.defaultAppManager';
defaultAppMgr.setDefaultApplicationSync(defaultAppMgr.ApplicationType.BROWSER, {
let info: defaultAppMgr.ElementName = {
bundleName: "com.example.myapplication",
moduleName: "module01",
abilityName: "EntryAbility"
}).then((data) => {
}
defaultAppMgr.setDefaultApplicationSync(defaultAppMgr.ApplicationType.BROWSER, info).then((data: defaultAppMgr.AsyncCallback<BundleInfo>) => {
console.info('Operation successful.');
}).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
});
let userId = 100;
defaultAppMgr.setDefaultApplicationSync(defaultAppMgr.ApplicationType.BROWSER, {
bundleName: "com.example.myapplication",
moduleName: "module01",
abilityName: "EntryAbility"
}, userId).then((data) => {
defaultAppMgr.setDefaultApplicationSync(defaultAppMgr.ApplicationType.BROWSER, info, userId).then((data: defaultAppMgr.AsyncCallback<BundleInfo>) => {
console.info('Operation successful.');
}).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
});
defaultAppMgr.setDefaultApplicationSync("image/png", {
bundleName: "com.example.myapplication",
moduleName: "module01",
abilityName: "EntryAbility"
}, userId).then((data) => {
defaultAppMgr.setDefaultApplicationSync("image/png", info, userId).then((data: defaultAppMgr.AsyncCallback<BundleInfo>) => {
console.info('Operation successful.');
}).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
......@@ -635,7 +625,7 @@ resetDefaultApplication(type: string, userId?: number): Promise\<void>
import defaultAppMgr from '@ohos.bundle.defaultAppManager';
let userId = 100;
defaultAppMgr.resetDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, userId)
.then((data) => {
.then((data: defaultAppMgr.AsyncCallback<void>) => {
console.info('Operation successful.');
})
.catch((error) => {
......@@ -643,7 +633,7 @@ defaultAppMgr.resetDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, use
});
defaultAppMgr.resetDefaultApplication("image/png", userId)
.then((data) => {
.then((data: defaultAppMgr.AsyncCallback<void>) => {
console.info('Operation successful.');
})
.catch((error) => {
......@@ -684,8 +674,10 @@ resetDefaultApplication(type: string, userId: number, callback: AsyncCallback\<v
```ts
import defaultAppMgr from '@ohos.bundle.defaultAppManager';
import { BusinessError } from '@ohos.base';
let userId = 100;
defaultAppMgr.resetDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, userId, (err, data) => {
defaultAppMgr.resetDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, userId, (err: BusinessError, data: defaultAppMgr.AsyncCallback<BundleInfo>) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
......@@ -693,7 +685,7 @@ defaultAppMgr.resetDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, use
console.info('Operation successful.');
});
defaultAppMgr.resetDefaultApplication("image/png", userId, (err, data) => {
defaultAppMgr.resetDefaultApplication("image/png", userId, (err: BusinessError, data: defaultAppMgr.AsyncCallback<BundleInfo>) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
......@@ -733,7 +725,9 @@ resetDefaultApplication(type: string, callback: AsyncCallback\<void>) : void;
```ts
import defaultAppMgr from '@ohos.bundle.defaultAppManager';
defaultAppMgr.resetDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, (err, data) => {
import { BusinessError } from '@ohos.base';
defaultAppMgr.resetDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, (err: BusinessError, data: defaultAppMgr.AsyncCallback<BundleInfo>) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
......@@ -741,7 +735,7 @@ defaultAppMgr.resetDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, (er
console.info('Operation successful.');
});
defaultAppMgr.resetDefaultApplication("image/png", (err, data) => {
defaultAppMgr.resetDefaultApplication("image/png", (err: BusinessError, data: defaultAppMgr.AsyncCallback<BundleInfo>) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
......@@ -784,7 +778,7 @@ resetDefaultApplicationSync(type: string, userId?: number): void;
import defaultAppMgr from '@ohos.bundle.defaultAppManager';
let userId = 100;
defaultAppMgr.resetDefaultApplicationSync(defaultAppMgr.ApplicationType.BROWSER, userId)
.then((data) => {
.then((data: defaultAppMgr.AsyncCallback<void>) => {
console.info('Operation successful.');
})
.catch((error) => {
......@@ -792,7 +786,7 @@ defaultAppMgr.resetDefaultApplicationSync(defaultAppMgr.ApplicationType.BROWSER,
});
defaultAppMgr.resetDefaultApplicationSync("image/png", userId)
.then((data) => {
.then((data: defaultAppMgr.AsyncCallback<void>) => {
console.info('Operation successful.');
})
.catch((error) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册