未验证 提交 68661ced 编写于 作者: 1 189******51 提交者: Gitee

IssueNo: #I7UZUJ:[新需求]: Rectify the arkts syntax

Description: Rectify the arkts syntax
Sig: SIG_ApplicaitonFramework
Feature or Bugfix: Feature
Binary Source: No
Signed-off-by: N189******51 <lipeicheng5@huawei.com>
上级 0182aa62
...@@ -51,9 +51,11 @@ getLauncherAbilityInfo(bundleName: string, userId: number, callback: AsyncCallba ...@@ -51,9 +51,11 @@ getLauncherAbilityInfo(bundleName: string, userId: number, callback: AsyncCallba
```ts ```ts
import launcherBundleManager from '@ohos.bundle.launcherBundleManager'; import launcherBundleManager from '@ohos.bundle.launcherBundleManager';
import { BusinessError } from '@ohos.base';
try { try {
launcherBundleManager.getLauncherAbilityInfo('com.example.demo', 100, (errData, data) => { launcherBundleManager.getLauncherAbilityInfo('com.example.demo', 100,
(errData: BusinessError, data: launcherBundleManager.LauncherAbilityInfo[]) => {
if (errData !== null) { if (errData !== null) {
console.error(`errData is errCode:${errData.code} message:${errData.message}`); console.error(`errData is errCode:${errData.code} message:${errData.message}`);
} else { } else {
...@@ -198,9 +200,11 @@ getAllLauncherAbilityInfo(userId: number, callback: AsyncCallback<Array\<[Launch ...@@ -198,9 +200,11 @@ getAllLauncherAbilityInfo(userId: number, callback: AsyncCallback<Array\<[Launch
```ts ```ts
import launcherBundleManager from '@ohos.bundle.launcherBundleManager'; import launcherBundleManager from '@ohos.bundle.launcherBundleManager';
import { BusinessError } from '@ohos.base';
try { try {
launcherBundleManager.getAllLauncherAbilityInfo(100, (errData, data) => { launcherBundleManager.getAllLauncherAbilityInfo(100,
(errData: BusinessError, data: launcherBundleManager.LauncherAbilityInfo[]) => {
if (errData !== null) { if (errData !== null) {
console.error(`errData is errCode:${errData.code} message:${errData.message}`); console.error(`errData is errCode:${errData.code} message:${errData.message}`);
} else { } else {
...@@ -247,11 +251,13 @@ getAllLauncherAbilityInfo(userId: number) : Promise<Array\<[LauncherAbilityInfo] ...@@ -247,11 +251,13 @@ getAllLauncherAbilityInfo(userId: number) : Promise<Array\<[LauncherAbilityInfo]
```ts ```ts
import launcherBundleManager from '@ohos.bundle.launcherBundleManager'; import launcherBundleManager from '@ohos.bundle.launcherBundleManager';
import { BusinessError } from '@ohos.base';
try { try {
launcherBundleManager.getAllLauncherAbilityInfo(100).then(data => { launcherBundleManager.getAllLauncherAbilityInfo(100)
.then((data: launcherBundleManager.LauncherAbilityInfo[]) => {
console.log("data is " + JSON.stringify(data)); console.log("data is " + JSON.stringify(data));
}).catch (errData => { }).catch ((errData: BusinessError) => {
console.error(`errData is errCode:${errData.code} message:${errData.message}`); console.error(`errData is errCode:${errData.code} message:${errData.message}`);
}); });
} catch (errData) { } catch (errData) {
...@@ -293,9 +299,11 @@ getShortcutInfo(bundleName :string, callback: AsyncCallback<Array\<[ShortcutInfo ...@@ -293,9 +299,11 @@ getShortcutInfo(bundleName :string, callback: AsyncCallback<Array\<[ShortcutInfo
```ts ```ts
import launcherBundleManager from '@ohos.bundle.launcherBundleManager'; import launcherBundleManager from '@ohos.bundle.launcherBundleManager';
import { BusinessError } from '@ohos.base';
try { try {
launcherBundleManager.getShortcutInfo("com.example.demo", (errData, data) => { launcherBundleManager.getShortcutInfo("com.example.demo",
(errData: BusinessError, data: launcherBundleManager.ShortcutInfo[]) => {
if (errData !== null) { if (errData !== null) {
console.error(`errData is errCode:${errData.code} message:${errData.message}`); console.error(`errData is errCode:${errData.code} message:${errData.message}`);
} else { } else {
...@@ -341,11 +349,13 @@ getShortcutInfo(bundleName : string) : Promise<Array\<[ShortcutInfo](js-apis-bun ...@@ -341,11 +349,13 @@ getShortcutInfo(bundleName : string) : Promise<Array\<[ShortcutInfo](js-apis-bun
```ts ```ts
import launcherBundleManager from '@ohos.bundle.launcherBundleManager'; import launcherBundleManager from '@ohos.bundle.launcherBundleManager';
import { BusinessError } from '@ohos.base';
try { try {
launcherBundleManager.getShortcutInfo("com.example.demo").then(data => { launcherBundleManager.getShortcutInfo("com.example.demo")
.then((data: launcherBundleManager.ShortcutInfo[]) => {
console.log("data is " + JSON.stringify(data)); console.log("data is " + JSON.stringify(data));
}).catch (errData => { }).catch ((errData: BusinessError) => {
console.error(`errData is errCode:${errData.code} message:${errData.message}`); console.error(`errData is errCode:${errData.code} message:${errData.message}`);
}); });
} catch (errData) { } catch (errData) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册