未验证 提交 7eae84f1 编写于 作者: 耿文广 提交者: Gitee

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

Signed-off-by: N耿文广 <gengwenguang@huawei.com>
上级 82e6e7b2
......@@ -307,25 +307,32 @@ setDefaultApplication(type: string, elementName: ElementName, userId?: number):
import defaultAppMgr from '@ohos.bundle.defaultAppManager';
import { BusinessError } from '@ohos.base';
let info = {
defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, {
bundleName: "com.example.myapplication",
moduleName: "module01",
abilityName: "EntryAbility"
}
defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, info).then((data) => {
}).then((data) => {
console.info('Operation successful.');
}).catch((error: BusinessError) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
});
let userId = 100;
defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, info, userId).then((data) => {
defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, {
bundleName: "com.example.myapplication",
moduleName: "module01",
abilityName: "EntryAbility"
}, userId).then((data) => {
console.info('Operation successful.');
}).catch((error: BusinessError) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
});
defaultAppMgr.setDefaultApplication("image/png", info, userId).then((data) => {
defaultAppMgr.setDefaultApplication("image/png", {
bundleName: "com.example.myapplication",
moduleName: "module01",
abilityName: "EntryAbility"
}, userId).then((data) => {
console.info('Operation successful.');
}).catch((error: BusinessError) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
......@@ -370,12 +377,11 @@ import defaultAppMgr from '@ohos.bundle.defaultAppManager';
import { BusinessError } from '@ohos.base';
let userId = 100;
let info = {
defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, {
bundleName: "com.example.myapplication",
moduleName: "module01",
abilityName: "EntryAbility"
}
defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, info, userId, (err: BusinessError, data) => {
}, userId, (err: BusinessError, data) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
......@@ -383,7 +389,11 @@ defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, info,
console.info('Operation successful.');
});
defaultAppMgr.setDefaultApplication("image/png", info, userId, (err: BusinessError, data) => {
defaultAppMgr.setDefaultApplication("image/png", {
bundleName: "com.example.myapplication",
moduleName: "module01",
abilityName: "EntryAbility"
}, userId, (err: BusinessError, data) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
......@@ -427,12 +437,11 @@ setDefaultApplication(type: string, elementName: ElementName, callback: AsyncCal
import defaultAppMgr from '@ohos.bundle.defaultAppManager';
import { BusinessError } from '@ohos.base';
let info = {
defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, {
bundleName: "com.example.myapplication",
moduleName: "module01",
abilityName: "EntryAbility"
}
defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, info, (err: BusinessError, data) => {
}, (err: BusinessError, data) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
......@@ -440,7 +449,11 @@ defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, info,
console.info('Operation successful.');
});
defaultAppMgr.setDefaultApplication("image/png", info, (err: BusinessError, data) => {
defaultAppMgr.setDefaultApplication("image/png", {
bundleName: "com.example.myapplication",
moduleName: "module01",
abilityName: "EntryAbility"
}, (err: BusinessError, data) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册