diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-ability.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-ability.md index 4ccaf65fa4a8706ec800ecbb615c54ae46d1d4cc..876bb23b3e953fe892b4afa21df4d2b0bf9e8284 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-ability.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-ability.md @@ -30,7 +30,7 @@ onConfigurationUpdate(newConfig: Configuration): void; **示例:** ```ts - class myAbility extends Ability { + class MyAbility extends Ability { onConfigurationUpdate(config) { console.log('onConfigurationUpdate, config:' + JSON.stringify(config)); } @@ -54,7 +54,7 @@ onMemoryLevel(level: AbilityConstant.MemoryLevel): void; **示例:** ```ts - class myAbility extends Ability { + class MyAbility extends Ability { onMemoryLevel(level) { console.log('onMemoryLevel, level:' + JSON.stringify(level)); } diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md index 74afea1750f032f272f9a10a9eaedb96854e2946..e044fef1b0cf759fff186a066fa9f3f014f93d28 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md @@ -27,7 +27,7 @@ onAbilityCreate(ability: UIAbility): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | ability | [UIAbility](js-apis-application-ability.md#Ability) | 是 | 当前Ability对象 | + | ability | [UIAbility](js-apis-app-ability-uiAbility.md#Ability) | 是 | 当前Ability对象 | ## AbilityLifecycleCallback.onWindowStageCreate @@ -42,7 +42,7 @@ onWindowStageCreate(ability: UIAbility, windowStage: window.WindowStage): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | ability | [UIAbility](js-apis-application-ability.md#Ability) | 是 | 当前Ability对象 | + | ability | [UIAbility](js-apis-app-ability-uiAbility.md#Ability) | 是 | 当前Ability对象 | | windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | 是 | 当前WindowStage对象 | @@ -58,7 +58,7 @@ onWindowStageActive(ability: UIAbility, windowStage: window.WindowStage): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | ability | [UIAbility](js-apis-application-ability.md#Ability) | 是 | 当前Ability对象 | + | ability | [UIAbility](js-apis-app-ability-uiAbility.md#Ability) | 是 | 当前Ability对象 | | windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | 是 | 当前WindowStage对象 | @@ -74,7 +74,7 @@ onWindowStageInactive(ability: UIAbility, windowStage: window.WindowStage): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | ability | [UIAbility](js-apis-application-ability.md#Ability) | 是 | 当前Ability对象 | + | ability | [UIAbility](js-apis-app-ability-uiAbility.md#Ability) | 是 | 当前Ability对象 | | windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | 是 | 当前WindowStage对象 | @@ -90,7 +90,7 @@ onWindowStageDestroy(ability: UIAbility, windowStage: window.WindowStage): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | ability | [UIAbility](js-apis-application-ability.md#Ability) | 是 | 当前Ability对象 | + | ability | [UIAbility](js-apis-app-ability-uiAbility.md#Ability) | 是 | 当前Ability对象 | | windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | 是 | 当前WindowStage对象 | @@ -106,7 +106,7 @@ onAbilityDestroy(ability: UIAbility): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | ability | [UIAbility](js-apis-application-ability.md#Ability) | 是 | 当前Ability对象 | + | ability | [UIAbility](js-apis-app-ability-uiAbility.md#Ability) | 是 | 当前Ability对象 | ## AbilityLifecycleCallback.onAbilityForeground @@ -121,7 +121,7 @@ onAbilityForeground(ability: UIAbility): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | ability | [UIAbility](js-apis-application-ability.md#Ability) | 是 | 当前Ability对象 | + | ability | [UIAbility](js-apis-app-ability-uiAbility.md#Ability) | 是 | 当前Ability对象 | ## AbilityLifecycleCallback.onAbilityBackground @@ -136,7 +136,7 @@ onAbilityBackground(ability: UIAbility): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | ability | [UIAbility](js-apis-application-ability.md#Ability) | 是 | 当前Ability对象 | + | ability | [UIAbility](js-apis-app-ability-uiAbility.md#Ability) | 是 | 当前Ability对象 | ## AbilityLifecycleCallback.onAbilityContinue @@ -151,7 +151,7 @@ onAbilityContinue(ability: UIAbility): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | ability | [UIAbility](js-apis-application-ability.md#Ability) | 是 | 当前Ability对象 | + | ability | [UIAbility](js-apis-app-ability-uiAbility.md#Ability) | 是 | 当前Ability对象 | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md index e7fc3496716c502f2735448b17553ebd41723974..40bb0e9319bae4dd27a69e8b6837cadbe81aaea0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md @@ -10,7 +10,7 @@ AbilityManager模块提供对Ability相关信息和状态信息进行获取、 ## 导入模块 ```ts -import AbilityManager from '@ohos.app.ability.abilityManager' +import abilityManager from '@ohos.app.ability.abilityManager' ``` ## AbilityState @@ -49,14 +49,12 @@ updateConfiguration(config: Configuration, callback: AsyncCallback\): void **示例**: ```ts -import abilitymanager from '@ohos.app.ability.abilityManager'; - var config = { language: 'chinese' } try { - abilitymanager.updateConfiguration(config, () => { + abilityManager.updateConfiguration(config, () => { console.log('------------ updateConfiguration -----------'); }) } catch (paramError) { @@ -90,14 +88,12 @@ updateConfiguration(config: Configuration): Promise\ **示例**: ```ts -import abilitymanager from '@ohos.app.ability.abilityManager'; - var config = { language: 'chinese' } try { - abilitymanager.updateConfiguration(config).then(() => { + abilityManager.updateConfiguration(config).then(() => { console.log('updateConfiguration success'); }).catch((err) => { console.log('updateConfiguration fail'); @@ -127,10 +123,8 @@ getAbilityRunningInfos(callback: AsyncCallback\>): vo **示例**: ```ts -import abilitymanager from '@ohos.app.ability.abilityManager'; - try { - abilitymanager.getAbilityRunningInfos((err,data) => { + abilityManager.getAbilityRunningInfos((err,data) => { console.log("getAbilityRunningInfos err: " + err + " data: " + JSON.stringify(data)); }); } catch (paramError) { @@ -158,10 +152,8 @@ getAbilityRunningInfos(): Promise\> **示例**: ```ts -import abilitymanager from '@ohos.app.ability.abilityManager'; - try { - abilitymanager.getAbilityRunningInfos().then((data) => { + abilityManager.getAbilityRunningInfos().then((data) => { console.log("getAbilityRunningInfos data: " + JSON.stringify(data)) }).catch((err) => { console.log("getAbilityRunningInfos err: " + err) @@ -192,12 +184,10 @@ getExtensionRunningInfos(upperLimit: number, callback: AsyncCallback\ { + abilityManager.getExtensionRunningInfos(upperLimit, (err,data) => { console.log("getExtensionRunningInfos err: " + err + " data: " + JSON.stringify(data)); }); } catch (paramError) { @@ -231,12 +221,10 @@ getExtensionRunningInfos(upperLimit: number): Promise\ { + abilityManager.getExtensionRunningInfos(upperLimit).then((data) => { console.log("getAbilityRunningInfos data: " + JSON.stringify(data)); }).catch((err) => { console.log("getAbilityRunningInfos err: " + err); @@ -264,16 +252,9 @@ getTopAbility(callback: AsyncCallback\): void; **示例**: ```ts -import abilitymanager from '@ohos.app.ability.abilityManager'; - -try { - abilitymanager.getTopAbility((err,data) => { +abilityManager.getTopAbility((err,data) => { console.log("getTopAbility err: " + err + " data: " + JSON.stringify(data)); - }); -} catch (paramError) { - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); -} +}); ``` ## getTopAbility @@ -293,16 +274,9 @@ getTopAbility(): Promise\; **示例**: ```ts -import abilitymanager from '@ohos.app.ability.abilityManager'; - -try { - abilitymanager.getTopAbility().then((data) => { +abilityManager.getTopAbility().then((data) => { console.log("getTopAbility data: " + JSON.stringify(data)); - }).catch((err) => { +}).catch((err) => { console.log("getTopAbility err: " + err); - }) -} catch (paramError) { - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); -} +}) ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-appManager.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-appManager.md index eb1b622e13de1a7e99cb36d1e1dbf141c40bb8c9..60f6019bea02d61250f2f8653744356a3a4c761b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-appManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-appManager.md @@ -12,7 +12,7 @@ appManager模块提供App管理的能力,包括查询当前是否处于稳定 import appManager from '@ohos.app.ability.appManager'; ``` -## appManager.isRunningInStabilityTest9+ +## appManager.isRunningInStabilityTest static isRunningInStabilityTest(callback: AsyncCallback<boolean>): void @@ -29,14 +29,14 @@ static isRunningInStabilityTest(callback: AsyncCallback<boolean>): void **示例:** ```ts - import app from '@ohos.application.appManager'; - app.isRunningInStabilityTest((err, flag) => { - console.log('startAbility result:' + JSON.stringify(err)); + appManager.isRunningInStabilityTest((err, flag) => { + console.log('error:' + JSON.stringify(err)); + console.log('The result of isRunningInStabilityTest is:' + JSON.stringify(flag)); }) ``` -## appManager.isRunningInStabilityTest9+ +## appManager.isRunningInStabilityTest static isRunningInStabilityTest(): Promise<boolean> @@ -53,11 +53,10 @@ static isRunningInStabilityTest(): Promise<boolean> **示例:** ```ts - import app from '@ohos.application.appManager'; - app.isRunningInStabilityTest().then((flag) => { - console.log('success:' + JSON.stringify(flag)); + appManager.isRunningInStabilityTest().then((flag) => { + console.log('The result of isRunningInStabilityTest is:' + JSON.stringify(flag)); }).catch((error) => { - console.log('failed:' + JSON.stringify(error)); + console.log('error:' + JSON.stringify(error)); }); ``` @@ -79,10 +78,10 @@ isRamConstrainedDevice(): Promise\; **示例:** ```ts - app.isRamConstrainedDevice().then((data) => { - console.log('success:' + JSON.stringify(data)); + appManager.isRamConstrainedDevice().then((data) => { + console.log('The result of isRamConstrainedDevice is:' + JSON.stringify(data)); }).catch((error) => { - console.log('failed:' + JSON.stringify(error)); + console.log('error:' + JSON.stringify(error)); }); ``` @@ -103,9 +102,9 @@ isRamConstrainedDevice(callback: AsyncCallback\): void; **示例:** ```ts - app.isRamConstrainedDevice((err, data) => { - console.log('startAbility result failed:' + JSON.stringify(err)); - console.log('startAbility result success:' + JSON.stringify(data)); + appManager.isRamConstrainedDevice((err, data) => { + console.log('error:' + JSON.stringify(err)); + console.log('The result of isRamConstrainedDevice is:' + JSON.stringify(data)); }) ``` @@ -126,10 +125,10 @@ getAppMemorySize(): Promise\; **示例:** ```ts - app.getAppMemorySize().then((data) => { - console.log('success:' + JSON.stringify(data)); + appManager.getAppMemorySize().then((data) => { + console.log('The size of app memory is:' + JSON.stringify(data)); }).catch((error) => { - console.log('failed:' + JSON.stringify(error)); + console.log('error:' + JSON.stringify(error)); }); ``` @@ -150,9 +149,9 @@ getAppMemorySize(callback: AsyncCallback\): void; **示例:** ```ts - app.getAppMemorySize((err, data) => { - console.log('startAbility result failed :' + JSON.stringify(err)); - console.log('startAbility result success:' + JSON.stringify(data)); + appManager.getAppMemorySize((err, data) => { + console.log('error:' + JSON.stringify(err)); + console.log('The size of app memory is:' + JSON.stringify(data)); }) ``` @@ -177,10 +176,10 @@ getProcessRunningInformation(): Promise\>; **示例:** ```ts - app.getProcessRunningInformation().then((data) => { - console.log('success:' + JSON.stringify(data)); + appManager.getProcessRunningInformation().then((data) => { + console.log('The process running infomation is:' + JSON.stringify(data)); }).catch((error) => { - console.log('failed:' + JSON.stringify(error)); + console.log('error:' + JSON.stringify(error)); }); ``` @@ -205,9 +204,9 @@ getProcessRunningInformation(callback: AsyncCallback\ { - console.log('startAbility result failed :' + JSON.stringify(err)); - console.log('startAbility result success:' + JSON.stringify(data)); + appManager.getProcessRunningInformation((err, data) => { + console.log('error :' + JSON.stringify(err)); + console.log('The process running information is:' + JSON.stringify(data)); }) ``` @@ -251,7 +250,7 @@ on(type: "applicationState", observer: ApplicationStateObserver): number; } } try { - const observerCode = app.on(applicationStateObserver); + const observerCode = appManager.on(applicationStateObserver); console.log('-------- observerCode: ---------', observerCode); } catch (paramError) { console.log('error: ' + paramError.code + ', ' + paramError.message); @@ -301,7 +300,7 @@ on(type: "applicationState", observer: ApplicationStateObserver, bundleNameList: } var bundleNameList = ['bundleName1', 'bundleName2']; try { - const observerCode = app.on("applicationState", applicationStateObserver, bundleNameList); + const observerCode = appManager.on("applicationState", applicationStateObserver, bundleNameList); console.log('-------- observerCode: ---------', observerCode); } catch (paramError) { console.log('error: ' + paramError.code + ', ' + paramError.message); @@ -339,7 +338,7 @@ off(type: "applicationState", observerId: number, callback: AsyncCallback\; var observerId = 100; try { - app.off(observerId) + appManager.off(observerId) .then((data) => { console.log('----------- unregisterApplicationStateObserver success ----------', data); }) @@ -409,14 +408,18 @@ getForegroundApplications(callback: AsyncCallback\>): void; **示例:** ```js - function getForegroundApplicationsCallback(err, data) { - if (err) { - console.log('--------- getForegroundApplicationsCallback fail ---------', err.code + ': ' + err.message); - } else { - console.log('--------- getForegroundApplicationsCallback success ---------', data) - } + function getForegroundApplicationsCallback(err, data) { + if (err) { + console.log('--------- getForegroundApplicationsCallback fail ---------', err.code + ': ' + err.message); + } else { + console.log('--------- getForegroundApplicationsCallback success ---------', data) } - app.getForegroundApplications(getForegroundApplicationsCallback); + } + try { + appManager.getForegroundApplications(getForegroundApplicationsCallback); + } catch (paramError) { + console.log("error: " + paramError.code + ", " + paramError.message); + } ``` unregisterApplicationStateObserver(observerId: number): Promise\; @@ -445,16 +448,20 @@ unregisterApplicationStateObserver(observerId: number): Promise\; ```ts var observerId = 100; - app.unregisterApplicationStateObserver(observerId) - .then((data) => { + try { + appManager.unregisterApplicationStateObserver(observerId) + .then((data) => { console.log('----------- unregisterApplicationStateObserver success ----------', data); - }) - .catch((err) => { + }) + .catch((err) => { console.log('----------- unregisterApplicationStateObserver fail ----------', err); - }) + }) + } catch (paramError) { + console.log("error: " + paramError.code + ", " + paramError.message); + } ``` -## appManager.getForegroundApplications9+ +## appManager.getForegroundApplications getForegroundApplications(callback: AsyncCallback\>): void; @@ -482,10 +489,14 @@ getForegroundApplications(callback: AsyncCallback\>): void; console.log('--------- getForegroundApplicationsCallback success ---------', data) } } - app.getForegroundApplications(getForegroundApplicationsCallback); + try { + appManager.getForegroundApplications(getForegroundApplicationsCallback); + } catch (paramError) { + console.log("error: " + paramError.code + ", " + paramError.message); + } ``` -## appManager.getForegroundApplications9+ +## appManager.getForegroundApplications getForegroundApplications(): Promise\>; @@ -506,7 +517,7 @@ getForegroundApplications(): Promise\>; **示例:** ```ts - app.getForegroundApplications() + appManager.getForegroundApplications() .then((data) => { console.log('--------- getForegroundApplications success -------', data); }) @@ -515,7 +526,7 @@ getForegroundApplications(): Promise\>; }) ``` -## appManager.killProcessWithAccount9+ +## appManager.killProcessWithAccount killProcessWithAccount(bundleName: string, accountId: number): Promise\ @@ -539,17 +550,21 @@ killProcessWithAccount(bundleName: string, accountId: number): Promise\ ```ts var bundleName = 'bundleName'; var accountId = 0; -app.killProcessWithAccount(bundleName, accountId) +try { + appManager.killProcessWithAccount(bundleName, accountId) .then((data) => { console.log('------------ killProcessWithAccount success ------------', data); }) .catch((err) => { console.log('------------ killProcessWithAccount fail ------------', err); }) +} catch (paramError) { + console.log("error: " + paramError.code + ", " + paramError.message); +} ``` -## appManager.killProcessWithAccount9+ +## appManager.killProcessWithAccount killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCallback\): void @@ -581,10 +596,10 @@ function killProcessWithAccountCallback(err, data) { console.log('------------- killProcessWithAccountCallback success, data: --------------', data); } } -app.killProcessWithAccount(bundleName, accountId, killProcessWithAccountCallback); +appManager.killProcessWithAccount(bundleName, accountId, killProcessWithAccountCallback); ``` -## appManager.killProcessesByBundleName9+ +## appManager.killProcessesByBundleName killProcessesByBundleName(bundleName: string, callback: AsyncCallback\); @@ -614,10 +629,14 @@ killProcessesByBundleName(bundleName: string, callback: AsyncCallback\); console.log('------------- killProcessesByBundleNameCallback success, data: --------------', data); } } - app.killProcessesByBundleName(bundleName, killProcessesByBundleNameCallback); + try { + appManager.killProcessesByBundleName(bundleName, killProcessesByBundleNameCallback); + } catch (paramError) { + console.log("error: " + paramError.code + ", " + paramError.message); + } ``` -## appManager.killProcessesByBundleName9+ +## appManager.killProcessesByBundleName killProcessesByBundleName(bundleName: string): Promise\; @@ -644,17 +663,21 @@ killProcessesByBundleName(bundleName: string): Promise\; **示例:** ```ts -var bundleName = 'bundleName'; -app.killProcessesByBundleName(bundleName) - .then((data) => { - console.log('------------ killProcessesByBundleName success ------------', data); - }) - .catch((err) => { - console.log('------------ killProcessesByBundleName fail ------------', err); - }) + var bundleName = 'bundleName'; + try { + appManager.killProcessesByBundleName(bundleName) + .then((data) => { + console.log('------------ killProcessesByBundleName success ------------', data); + }) + .catch((err) => { + console.log('------------ killProcessesByBundleName fail ------------', err); + }) + } catch (paramError) { + console.log("error: " + paramError.code + ", " + paramError.message); + } ``` -## appManager.clearUpApplicationData9+ +## appManager.clearUpApplicationData clearUpApplicationData(bundleName: string, callback: AsyncCallback\); @@ -684,10 +707,14 @@ clearUpApplicationData(bundleName: string, callback: AsyncCallback\); console.log('------------- clearUpApplicationDataCallback success, data: --------------', data); } } - app.clearUpApplicationData(bundleName, clearUpApplicationDataCallback); + try { + appManager.clearUpApplicationData(bundleName, clearUpApplicationDataCallback); + } catch (paramError) { + console.log("error: " + paramError.code + ", " + paramError.message); + } ``` -## appManager.clearUpApplicationData9+ +## appManager.clearUpApplicationData clearUpApplicationData(bundleName: string): Promise\; @@ -715,16 +742,20 @@ clearUpApplicationData(bundleName: string): Promise\; ```ts var bundleName = 'bundleName'; - app.clearUpApplicationData(bundleName) - .then((data) => { + try { + appManager.clearUpApplicationData(bundleName) + .then((data) => { console.log('------------ clearUpApplicationData success ------------', data); - }) - .catch((err) => { + }) + .catch((err) => { console.log('------------ clearUpApplicationData fail ------------', err); - }) + }) + } catch (paramError) { + console.log("error: " + paramError.code + ", " + paramError.message); + } ``` -## ApplicationState9+ +## ApplicationState **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -738,7 +769,7 @@ clearUpApplicationData(bundleName: string): Promise\; | STATE_BACKGROUND | 4 | 当应用处于后台不可见时处于的状态。 | | STATE_DESTROY | 5 | 当应用在销毁的时候处于的状态。 | -## ProcessState9+ +## ProcessState **系统能力**:SystemCapability.Ability.AbilityRuntime.Core diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md index 1f87ef14e76ebd855c43990ce2d84dbcb2ee3832..10e30910d83523ebafca2b14f11d560ef3f7e0f6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md @@ -67,6 +67,7 @@ enableAppRecovery(restart?: RestartFlag, saveOccasion?: SaveOccasionFlag, saveMo **示例:** ```ts +import AbilityStage from '@ohos.app.ability.AbilityStage'; export default class MyAbilityStage extends AbilityStage { onCreate() { appRecovery.enableAppRecovery(RestartFlag::ALWAYS_RESTART, SaveOccasionFlag::SAVE_WHEN_ERROR, SaveModeFlag::SAVE_WITH_FILE); @@ -86,6 +87,7 @@ restartApp(): void; **示例:** ```ts +import errorManager from '@ohos.app.ability.errorManager'; var observer = { onUnhandledException(errorMsg) { console.log('onUnhandledException, errorMsg: ', errorMsg) @@ -112,6 +114,7 @@ saveAppState(): boolean; **示例:** ```ts +import errorManager from '@ohos.app.ability.errorManager'; var observer = { onUnhandledException(errorMsg) { console.log('onUnhandledException, errorMsg: ', errorMsg) diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-configurationConstant.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-configurationConstant.md index 9250525023954ee7d1d25255e5e9458cee30676c..3a26f04f9c8e03b2b87f4acb3cd71eb6b3c459a9 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-configurationConstant.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-configurationConstant.md @@ -25,7 +25,7 @@ import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant'; | COLOR_MODE_LIGHT | 1 | 浅色模式。 | -## ConfigurationConstant.Direction9+ +## ConfigurationConstant.Direction 使用时通过ConfigurationConstant.Direction获取。 @@ -38,7 +38,7 @@ import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant'; | DIRECTION_HORIZONTAL | 1 | 水平方向。 | -## ConfigurationConstant.ScreenDensity9+ +## ConfigurationConstant.ScreenDensity 使用时通过ConfigurationConstant.ScreenDensity获取。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md index 607978f6ba30774aed87430bff710d896339e833..7b44e33f698d0a6feb0cb41537267ee61c9b932e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md @@ -33,11 +33,11 @@ onConfigurationUpdated(config: Configuration): void; ```ts -import Ability from "@ohos.application.Ability"; +import UIAbility from "@ohos.app.ability.Ability"; var callbackId; -export default class MyAbility extends Ability { +export default class MyAbility extends UIAbility { onCreate() { console.log("MyAbility onCreate") globalThis.applicationContext = this.context.getApplicationContext(); diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-errorManager.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-errorManager.md index 43a6a8e6d1835be75cf7dd2608211b39899ac385..15f8439162f300775078749ce1876a08d368ad69 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-errorManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-errorManager.md @@ -7,7 +7,7 @@ ErrorManager模块提供对错误观察器的注册和注销的能力。 > 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## 导入模块 -``` +```ts import errorManager from '@ohos.app.ability.errorManager' ``` @@ -28,7 +28,7 @@ on(type: "error", observer: ErrorObserver): number; **示例:** -```js +```ts var observer = { onUnhandledException(errorMsg) { console.log('onUnhandledException, errorMsg: ', errorMsg) @@ -59,7 +59,7 @@ off(type: "error", observerId: number, callback: AsyncCallback\): void; **示例:** -```js +```ts var observerId = 100; function unregisterErrorObserverCallback(err) { @@ -97,7 +97,7 @@ off(type: "error", observerId: number): Promise\; **示例:** -```js +```ts var observerId = 100; try { errorManager.off("error", observerId) diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md index 40c74d4fe845f25195ad37f14a2c5bfa31d60b82..2d643960b2c40d8ba50f3a44e8f9075328b28a7b 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md @@ -43,8 +43,7 @@ on(type:"mission", listener: MissionListener): number; **示例:** ```ts -import Ability from '@ohos.application.Ability' -import missionManager from '@ohos.app.ability.missionManager'; +import UIAbility from '@ohos.app.ability.UIAbility'; var listener = { onMissionCreated: function (mission) {console.log("--------onMissionCreated-------")}, @@ -57,7 +56,7 @@ var listener = { var listenerId = -1; -export default class MainAbility extends Ability { +export default class MainAbility extends UIAbility { onCreate(want, launchParam) { console.log("[Demo] MainAbility onCreate") globalThis.abilityWant = want; @@ -124,8 +123,7 @@ off(type: "mission", listenerId: number, callback: AsyncCallback<void>): v **示例:** ```ts -import Ability from '@ohos.application.Ability' -import missionManager from '@ohos.app.ability.missionManager'; +import UIAbility from '@ohos.app.ability.UIAbility'; var listener = { onMissionCreated: function (mission) {console.log("--------onMissionCreated-------")}, @@ -138,7 +136,7 @@ var listener = { var listenerId = -1; -export default class MainAbility extends Ability { +export default class MainAbility extends UIAbility { onCreate(want, launchParam) { console.log("[Demo] MainAbility onCreate") globalThis.abilityWant = want; @@ -210,8 +208,7 @@ off(type: "mission", listenerId: number): Promise<void>; **示例:** ```ts -import Ability from '@ohos.application.Ability' -import missionManager from '@ohos.app.ability.missionManager'; +import UIAbility from '@ohos.app.ability.UIAbility'; var listener = { onMissionCreated: function (mission) {console.log("--------onMissionCreated-------")}, @@ -224,7 +221,7 @@ var listener = { var listenerId = -1; -export default class MainAbility extends Ability { +export default class MainAbility extends UIAbility { onCreate(want, launchParam) { console.log("[Demo] MainAbility onCreate") globalThis.abilityWant = want; @@ -292,8 +289,6 @@ getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback<M **示例:** ```ts - import missionManager from '@ohos.app.ability.missionManager' - try { var allMissions=missionManager.getMissionInfos("",10).catch(function(err){console.log(err);}); missionManager.getMissionInfo("", allMissions[0].missionId, (error, mission) => { @@ -339,8 +334,6 @@ getMissionInfo(deviceId: string, missionId: number): Promise<MissionInfo>; **示例:** ```ts - import missionManager from '@ohos.app.ability.missionManager' - try { var mission = missionManager.getMissionInfo("", 10).catch(function (err){ console.log(err); @@ -374,8 +367,6 @@ getMissionInfos(deviceId: string, numMax: number, callback: AsyncCallback<Arr **示例:** ```ts - import missionManager from '@ohos.app.ability.missionManager' - try { missionManager.getMissionInfos("", 10, (error, missions) => { console.log("getMissionInfos is called, error.code = " + error.code); @@ -416,8 +407,6 @@ getMissionInfos(deviceId: string, numMax: number): Promise<Array<MissionIn **示例:** ```ts - import missionManager from '@ohos.app.ability.missionManager' - try { var allMissions = missionManager.getMissionInfos("", 10).catch(function (err){ console.log(err); @@ -451,8 +440,6 @@ getMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback& **示例:** ```ts - import missionManager from '@ohos.app.ability.missionManager' - try { missionManager.getMissionInfos("", 10, (error, missions) => { console.log("getMissionInfos is called, error.code = " + error.code); @@ -499,8 +486,6 @@ getMissionSnapShot(deviceId: string, missionId: number): Promise<MissionSnaps **示例:** ```ts - import missionManager from '@ohos.app.ability.missionManager' - try { var allMissions; missionManager.getMissionInfos("",10).then(function(res){ @@ -541,8 +526,6 @@ getLowResolutionMissionSnapShot(deviceId: string, missionId: number, callback: A **示例:** ```ts - import missionManager from '@ohos.app.ability.missionManager' - try { missionManager.getMissionInfos("", 10, (error, missions) => { console.log("getMissionInfos is called, error.code = " + error.code); @@ -589,8 +572,6 @@ getLowResolutionMissionSnapShot(deviceId: string, missionId: number): Promise\ { console.log("getMissionInfos is called, error.code = " + error.code); @@ -677,8 +656,6 @@ lockMission(missionId: number): Promise<void>; **示例:** ```ts - import missionManager from '@ohos.app.ability.missionManager' - try { var allMissions; missionManager.getMissionInfos("",10).then(function(res){ @@ -719,8 +696,6 @@ unlockMission(missionId: number, callback: AsyncCallback<void>): void; **示例:** ```ts - import missionManager from '@ohos.app.ability.missionManager' - try { missionManager.getMissionInfos("", 10, (error, missions) => { console.log("getMissionInfos is called, error.code = " + error.code); @@ -765,8 +740,6 @@ unlockMission(missionId: number): Promise<void>; **示例:** ```ts - import missionManager from '@ohos.app.ability.missionManager' - try { var allMissions; missionManager.getMissionInfos("",10).then(function(res){ @@ -810,8 +783,6 @@ clearMission(missionId: number, callback: AsyncCallback<void>): void; **示例:** ```ts - import missionManager from '@ohos.app.ability.missionManager' - try { missionManager.getMissionInfos("", 10, (error, missions) => { console.log("getMissionInfos is called, error.code = " + error.code); @@ -856,8 +827,6 @@ clearMission(missionId: number): Promise<void>; **示例:** ```ts - import missionManager from '@ohos.app.ability.missionManager' - try { var allMissions; missionManager.getMissionInfos("",10).then(function(res){ @@ -891,8 +860,6 @@ clearAllMissions(callback: AsyncCallback<void>): void; **示例:** ```ts - import missionManager from '@ohos.app.ability.missionManager' - missionManager.clearAllMissions().then(() => { console.log("clearAllMissions is called "); }); @@ -920,7 +887,6 @@ clearAllMissions(): Promise<void>; **示例:** ```ts - import missionManager from '@ohos.app.ability.missionManager' missionManager.clearAllMissions().catch(function (err){ console.log(err); }); @@ -949,8 +915,6 @@ moveMissionToFront(missionId: number, callback: AsyncCallback<void>): void **示例:** ```ts - import missionManager from '@ohos.app.ability.missionManager' - try { missionManager.getMissionInfos("", 10, (error, missions) => { console.log("getMissionInfos is called, error.code = " + error.code); @@ -991,8 +955,6 @@ moveMissionToFront(missionId: number, options: StartOptions, callback: AsyncCall **示例:** ```ts - import missionManager from '@ohos.app.ability.missionManager' - try { missionManager.getMissionInfos("", 10, (error, missions) => { console.log("getMissionInfos is called, error.code = " + error.code); @@ -1038,8 +1000,6 @@ moveMissionToFront(missionId: number, options?: StartOptions): Promise<void&g **示例:** ```ts - import missionManager from '@ohos.app.ability.missionManager' - try { var allMissions; missionManager.getMissionInfos("",10).then(function(res){ diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md index 0f2d943aa526835c41db0e62c38ae6fa5f71c028..5fb15755d95e2bd4a50d3ff8657f15a6d65cea62 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md @@ -65,8 +65,6 @@ applyQuickFix(hapModuleQuickFixFiles: Array\, callback: AsyncCallback\ { @@ -108,8 +106,6 @@ applyQuickFix(hapModuleQuickFixFiles: Array\): Promise\; **示例:** ```ts - import quickFixManager from '@ohos.app.ability.quickFixManager' - let hapModuleQuickFixFiles = ["/data/storage/el2/base/entry.hqf"] try { quickFixManager.applyQuickFix(hapModuleQuickFixFiles).then(() => { @@ -144,8 +140,6 @@ getApplicationQuickFixInfo(bundleName: string, callback: AsyncCallback\ { @@ -187,8 +181,6 @@ getApplicationQuickFixInfo(bundleName: string): Promise\ { diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md index 1a2c5de74ae9f2af61b9e0e60feed40a24375bec..440353707771e0d91193d43c5505f388f2d88897 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md @@ -4,7 +4,7 @@ ServiceExtensionAbility模块提供ServiceExtension服务扩展相关接口的 > **说明:** > -> 本模块首批接口从API version 9开始支持,从API version 9废弃,替换模块为[@ohos.app.ability.ServiceExtensionAbility](js-apis-app-ability-serviceExtensionAbility.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块接口仅可在Stage模型下使用。 ## 导入模块 diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md index dae0b47232d40963f057fa7a45691911ee1b9a0b..26d4c111f80bd1200d5a38fd7f0bcc78daa8e89b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md @@ -15,7 +15,7 @@ Ability模块提供对Ability生命周期、上下文环境等调用管理的能 ## 导入模块 ```ts -import Ability from '@ohos.app.ability.UIAbility'; +import UIAbility from '@ohos.app.ability.UIAbility'; ``` ## 属性 @@ -47,7 +47,7 @@ Ability创建时回调,执行初始化业务逻辑操作。 **示例:** ```ts - class myAbility extends Ability { + class MyAbility extends UIAbility { onCreate(want, param) { console.log('onCreate, want:' + want.abilityName); } @@ -72,7 +72,7 @@ onWindowStageCreate(windowStage: window.WindowStage): void **示例:** ```ts - class myAbility extends Ability { + class MyAbility extends UIAbility { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); } @@ -91,7 +91,7 @@ onWindowStageDestroy(): void **示例:** ```ts - class myAbility extends Ability { + class MyAbility extends UIAbility { onWindowStageDestroy() { console.log('onWindowStageDestroy'); } @@ -116,7 +116,7 @@ onWindowStageRestore(windowStage: window.WindowStage): void **示例:** ```ts - class myAbility extends Ability { + class MyAbility extends UIAbility { onWindowStageRestore(windowStage) { console.log('onWindowStageRestore'); } @@ -135,7 +135,7 @@ Ability生命周期回调,在销毁时回调,执行资源清理等操作。 **示例:** ```ts - class myAbility extends Ability { + class MyAbility extends UIAbility { onDestroy() { console.log('onDestroy'); } @@ -154,7 +154,7 @@ Ability生命周期回调,当应用从后台转到前台时触发。 **示例:** ```ts - class myAbility extends Ability { + class MyAbility extends UIAbility { onForeground() { console.log('onForeground'); } @@ -173,7 +173,7 @@ Ability生命周期回调,当应用从前台转到后台时触发。 **示例:** ```ts - class myAbility extends Ability { + class MyAbility extends UIAbility { onBackground() { console.log('onBackground'); } @@ -204,8 +204,8 @@ onContinue(wantParam : {[key: string]: any}): AbilityConstant.OnContinueResult; **示例:** ```ts - import AbilityConstant from "@ohos.application.AbilityConstant" - class myAbility extends Ability { + import AbilityConstant from "@ohos.app.ability.AbilityConstant" + class MyAbility extends UIAbility { onContinue(wantParams) { console.log('onContinue'); wantParams["myData"] = "my1234567"; @@ -227,13 +227,13 @@ onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-application-want.md) | 是 | Want类型参数,如ability名称,包名等。 | + | want | [Want](js-apis-app-ability-want.md) | 是 | Want类型参数,如ability名称,包名等。 | | launchParams | AbilityConstant.LaunchParam | 是 | Ability启动的原因、上次异常退出的原因信息。 | **示例:** ```ts - class myAbility extends Ability { + class MyAbility extends UIAbility { onNewWant(want) { console.log('onNewWant, want:' + want.abilityName); } @@ -257,7 +257,7 @@ onDump(params: Array\): Array\; **示例:** ```ts - class myAbility extends Ability { + class MyAbility extends UIAbility { onDump(params) { console.log('dump, params:' + JSON.stringify(params)); return ["params"] @@ -278,7 +278,7 @@ onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: any}) | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | reason | [AbilityConstant.StateType](js-apis-application-abilityConstant.md#abilityconstantstatetype) | 是 | 回调保存状态的原因。 | + | reason | [AbilityConstant.StateType](js-apis-app-ability-abilityConstant.md#abilityconstantstatetype) | 是 | 回调保存状态的原因。 | | wantParam | {[key: string]: any} | 是 | want相关参数。 | **返回值:** @@ -290,9 +290,9 @@ onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: any}) **示例:** ```ts -import AbilityConstant from '@ohos.application.AbilityConstant' +import AbilityConstant from '@ohos.app.ability.AbilityConstant' -class myAbility extends Ability { +class MyAbility extends UIAbility { onSaveState(reason, wantParam) { console.log('onSaveState'); wantParam["myData"] = "my1234567"; @@ -338,7 +338,6 @@ call(method: string, data: rpc.Sequenceable): Promise<void>; **示例:** ```ts - import Ability from '@ohos.app.ability.UIAbility'; class MyMessageAble{ // 自定义的Sequenceable数据结构 name:"" str:"" @@ -362,7 +361,7 @@ call(method: string, data: rpc.Sequenceable): Promise<void>; }; var method = 'call_Function'; // 约定的通知消息字符串 var caller; - export default class MainAbility extends Ability { + export default class MainAbility extends UIAbility { onWindowStageCreate(windowStage) { this.context.startAbilityByCall({ bundleName: "com.example.myservice", @@ -419,7 +418,6 @@ callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessagePa **示例:** ```ts - import Ability from '@ohos.app.ability.UIAbility'; class MyMessageAble{ name:"" str:"" @@ -443,7 +441,7 @@ callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessagePa }; var method = 'call_Function'; var caller; - export default class MainAbility extends Ability { + export default class MainAbility extends UIAbility { onWindowStageCreate(windowStage) { this.context.startAbilityByCall({ bundleName: "com.example.myservice", @@ -491,9 +489,8 @@ release(): void; **示例:** ```ts - import Ability from '@ohos.app.ability.UIAbility'; var caller; - export default class MainAbility extends Ability { + export default class MainAbility extends UIAbility { onWindowStageCreate(windowStage) { this.context.startAbilityByCall({ bundleName: "com.example.myservice", @@ -532,9 +529,8 @@ release(): void; **示例:** ```ts - import Ability from '@ohos.application.Ability'; var caller; - export default class MainAbility extends Ability { + export default class MainAbility extends UIAbility { onWindowStageCreate(windowStage) { this.context.startAbilityByCall({ bundleName: "com.example.myservice", @@ -583,9 +579,8 @@ release(): void; **示例:** ```ts - import Ability from '@ohos.app.ability.UIAbility'; var caller; - export default class MainAbility extends Ability { + export default class MainAbility extends UIAbility { onWindowStageCreate(windowStage) { this.context.startAbilityByCall({ bundleName: "com.example.myservice", @@ -639,7 +634,6 @@ on(method: string, callback: CalleeCallback): void; **示例:** ```ts - import Ability from '@ohos.app.ability.UIAbility'; class MyMessageAble{ name:"" str:"" @@ -668,7 +662,7 @@ on(method: string, callback: CalleeCallback): void; pdata.readSequenceable(msg); return new MyMessageAble("test1", "Callee test"); } - export default class MainAbility extends Ability { + export default class MainAbility extends UIAbility { onCreate(want, launchParam) { console.log('Callee onCreate is called'); try { @@ -706,9 +700,8 @@ off(method: string): void; **示例:** ```ts - import Ability from '@ohos.app.ability.UIAbility'; var method = 'call_Function'; - export default class MainAbility extends Ability { + export default class MainAbility extends UIAbility { onCreate(want, launchParam) { console.log('Callee onCreate is called'); try { diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md index 006fa77174247cffc574fe386db4ee7e7ded5431..325abee652ef25b720230da2e78c4ec059a8ac5d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md @@ -23,9 +23,9 @@ import Want from '@ohos.app.ability.Want'; | abilityName | string | 否 | 表示待启动的Ability名称。如果在Want中该字段同时指定了BundleName和AbilityName,则Want可以直接匹配到指定的Ability。AbilityName需要在一个应用的范围内保证唯一。 | | uri | string | 否 | 表示Uri描述。如果在Want中指定了Uri,则Want将匹配指定的Uri信息,包括scheme, schemeSpecificPart, authority和path信息。 | | type | string | 否 | 表示MIME type类型描述,打开文件的类型,主要用于文管打开文件。比如:"text/xml" 、 "image/*"等,MIME定义参考:https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com。 | -| flags | number | 否 | 表示处理Want的方式。默认传数字,具体参考:[flags说明](js-apis-ability-wantConstant.md#wantConstant.Flags)。 | +| flags | number | 否 | 表示处理Want的方式。默认传数字,具体参考:[flags说明](js-apis-app-ability-wantConstant.md#wantConstant.Flags)。 | | action | string | 否 | 表示要执行的通用操作(如:查看、分享、应用详情)。在隐式Want中,您可以定义该字段,配合uri或parameters来表示对数据要执行的操作。 | -| parameters | {[key: string]: any} | 否 | 表示WantParams描述,由开发者自行决定传入的键值对。默认会携带以下key值:
ohos.aafwk.callerPid 表示拉起方的pid。
ohos.aafwk.param.callerToken 表示拉起方的token。
ohos.aafwk.param.callerUid 表示[bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo-1)中的uid,应用包里应用程序的uid。 | +| parameters | {[key: string]: any} | 否 | 表示WantParams描述,由开发者自行决定传入的键值对。默认会携带以下key值:
ohos.aafwk.callerPid 表示拉起方的pid。
ohos.aafwk.param.callerToken 表示拉起方的token。
ohos.aafwk.param.callerUid 表示[bundleInfo](js-apis-bundleManager-bundleInfo.md#bundleinfo-1)中的uid,应用包里应用程序的uid。 | | entities | Array\ | 否 | 表示目标Ability额外的类别信息(如:浏览器、视频播放器),在隐式Want中是对action字段的补充。在隐式Want中,您可以定义该字段,来过滤匹配Ability类型。 | | moduleName | string | 否 | 表示待启动的Ability所属的模块(module)。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md index a4f7acf7c2a9abc895c86c806f12f0e80e9b0860..6b6007d2cc4889cfadf326bacac5f6523aa8cf32 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md @@ -28,7 +28,6 @@ getWantAgent(info: WantAgentInfo, callback: AsyncCallback\): void | callback | AsyncCallback\ | 是 | 创建WantAgent的回调方法。 | **错误码:** -以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) | 错误码ID | 错误信息 | |-----------|--------------------| | 16000001 | Input error. The specified ability name does not exist. | @@ -53,13 +52,12 @@ getWantAgent(info: WantAgentInfo, callback: AsyncCallback\): void | 16000151 | Invalid wantagent object.| | 16000152 | wantAgent object not found.| | 16000153 | wangAgent object canceled.| +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** ```ts -import WantAgent from '@ohos.app.ability.wantAgent'; - //wantAgent对象 var wantAgent; //WantAgentInfo对象 @@ -128,7 +126,6 @@ getWantAgent(info: WantAgentInfo): Promise\ | Promise\ | 以Promise形式返回WantAgent。 | **错误码:** -以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) | 错误码ID | 错误信息 | |-----------|--------------------| | 16000001 | Input error. The specified ability name does not exist. | @@ -153,13 +150,11 @@ getWantAgent(info: WantAgentInfo): Promise\ | 16000151 | Invalid wantagent object.| | 16000152 | wantAgent object not found.| | 16000153 | wangAgent object canceled.| +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** ```ts -import WantAgent from '@ohos.app.ability.wantAgent'; - - //WantAgentInfo对象 var wantAgentInfo = { wants: [ @@ -245,7 +240,6 @@ getBundleName(agent: WantAgent, callback: AsyncCallback\): void **示例:** ```ts -import WantAgent from '@ohos.app.ability.wantAgent'; //wantAgent对象 var wantAgent; //WantAgentInfo对象 @@ -327,7 +321,6 @@ getBundleName(agent: WantAgent): Promise\ | Promise\ | 以Promise形式返回获取WantAgent实例的包名。 | **错误码:** -以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) | 错误码ID | 错误信息 | |-----------|--------------------| | 16000001 | Input error. The specified ability name does not exist. | @@ -352,12 +345,11 @@ getBundleName(agent: WantAgent): Promise\ | 16000151 | Invalid wantagent object.| | 16000152 | wantAgent object not found.| | 16000153 | wangAgent object canceled.| +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** ```ts -import WantAgent from '@ohos.app.ability.wantAgent'; - //wantAgent对象 var wantAgent; //WantAgentInfo对象 @@ -430,7 +422,6 @@ getUid(agent: WantAgent, callback: AsyncCallback\): void | callback | AsyncCallback\ | 是 | 获取WantAgent实例的用户ID的回调方法。 | **错误码:** -以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) | 错误码ID | 错误信息 | |-----------|--------------------| | 16000001 | Input error. The specified ability name does not exist. | @@ -455,6 +446,7 @@ getUid(agent: WantAgent, callback: AsyncCallback\): void | 16000151 | Invalid wantagent object.| | 16000152 | wantAgent object not found.| | 16000153 | wangAgent object canceled.| +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** @@ -541,7 +533,6 @@ getUid(agent: WantAgent): Promise\ | Promise\ | 以Promise形式返回获取WantAgent实例的用户ID。 | **错误码:** -以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) | 错误码ID | 错误信息 | |-----------|--------------------| | 16000001 | Input error. The specified ability name does not exist. | @@ -566,13 +557,12 @@ getUid(agent: WantAgent): Promise\ | 16000151 | Invalid wantagent object.| | 16000152 | wantAgent object not found.| | 16000153 | wangAgent object canceled.| +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** ```ts -import WantAgent from '@ohos.app.ability.wantAgent'; - - //wantAgent对象 +//wantAgent对象 var wantAgent; //WantAgentInfo对象 var wantAgentInfo = { @@ -645,7 +635,6 @@ getWant(agent: WantAgent, callback: AsyncCallback\): void | callback | AsyncCallback\ | 是 | 获取WantAgent对象want的回调方法。 | **错误码:** -以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) |错误码ID |错误信息 | | 错误码ID | 错误信息 | |-----------|--------------------| @@ -671,11 +660,11 @@ getWant(agent: WantAgent, callback: AsyncCallback\): void | 16000151 | Invalid wantagent object.| | 16000152 | wantAgent object not found.| | 16000153 | wangAgent object canceled.| +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** ```ts -import WantAgent from '@ohos.app.ability.wantAgent'; //wantAgent对象 var wantAgent; //WantAgentInfo对象 @@ -759,7 +748,6 @@ getWant(agent: WantAgent): Promise\ | Promise\ | 以Promise形式返回获取WantAgent对象的want。 | **错误码:** -以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) | 错误码ID | 错误信息 | |-----------|--------------------| | 16000001 | Input error. The specified ability name does not exist. | @@ -784,13 +772,12 @@ getWant(agent: WantAgent): Promise\ | 16000151 | Invalid wantagent object.| | 16000152 | wantAgent object not found.| | 16000153 | wangAgent object canceled.| +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** ```ts -import WantAgent from '@ohos.app.ability.wantAgent'; - - //wantAgent对象 +//wantAgent对象 var wantAgent; //WantAgentInfo对象 var wantAgentInfo = { @@ -862,7 +849,6 @@ cancel(agent: WantAgent, callback: AsyncCallback\): void | callback | AsyncCallback\ | 是 | 取消WantAgent实例的回调方法。 | **错误码:** -以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) | 错误码ID | 错误信息 | |-----------|--------------------| | 16000001 | Input error. The specified ability name does not exist. | @@ -887,11 +873,11 @@ cancel(agent: WantAgent, callback: AsyncCallback\): void | 16000151 | Invalid wantagent object.| | 16000152 | wantAgent object not found.| | 16000153 | wangAgent object canceled.| +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** ```ts -import WantAgent from '@ohos.app.ability.wantAgent'; //wantAgent对象 var wantAgent; //WantAgentInfo对象 @@ -973,7 +959,6 @@ cancel(agent: WantAgent): Promise\ | Promise\ | 以Promise形式获取异步返回结果。 | **错误码:** -以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) | 错误码ID | 错误信息 | |-----------|--------------------| | 16000001 | Input error. The specified ability name does not exist. | @@ -998,12 +983,11 @@ cancel(agent: WantAgent): Promise\ | 16000151 | Invalid wantagent object.| | 16000152 | wantAgent object not found.| | 16000153 | wangAgent object canceled.| +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** ```ts -import WantAgent from '@ohos.app.ability.wantAgent'; - //wantAgent对象 var wantAgent; //WantAgentInfo对象 @@ -1079,7 +1063,6 @@ trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback\ | 否 | 主动激发WantAgent实例的回调方法。 | **错误码:** -以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) | 错误码ID | 错误信息 | |-----------|--------------------| | 16000001 | Input error. The specified ability name does not exist. | @@ -1104,11 +1087,11 @@ trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback\ | 是 | 判断两个WantAgent实例是否相等的回调方法。 | **错误码:** -以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) | 错误码ID | 错误信息 | |-----------|--------------------| | 16000001 | Input error. The specified ability name does not exist. | @@ -1215,11 +1197,11 @@ equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback\ | Promise\ | 以Promise形式返回获取判断两个WantAgent实例是否相等的结果。 | **错误码:** -以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) | 错误码ID | 错误信息 | |-----------|--------------------| | 16000001 | Input error. The specified ability name does not exist. | @@ -1329,13 +1310,12 @@ equal(agent: WantAgent, otherAgent: WantAgent): Promise\ | 16000151 | Invalid wantagent object.| | 16000152 | wantAgent object not found.| | 16000153 | wangAgent object canceled.| +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** ```ts -import WantAgent from '@ohos.app.ability.wantAgent'; - - //wantAgent对象 +//wantAgent对象 var wantAgent1; var wantAgent2; //WantAgentInfo对象 @@ -1407,7 +1387,6 @@ getOperationType(agent: WantAgent, callback: AsyncCallback\): void; | callback | AsyncCallback\ | 是 | 获取一个WantAgent的OperationType信息的回调方法。 | **错误码:** -以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) | 错误码ID | 错误信息 | |-----------|--------------------| | 16000001 | Input error. The specified ability name does not exist. | @@ -1432,11 +1411,11 @@ getOperationType(agent: WantAgent, callback: AsyncCallback\): void; | 16000151 | Invalid wantagent object.| | 16000152 | wantAgent object not found.| | 16000153 | wangAgent object canceled.| +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** ```ts -import WantAgent from '@ohos.app.ability.wantAgent'; //wantAgent对象 var wantAgent; //WantAgentInfo对象 @@ -1516,7 +1495,6 @@ getOperationType(agent: WantAgent): Promise\; | Promise\ | 以Promise形式返回获取operationType的结果。 | **错误码:** -以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) | 错误码ID | 错误信息 | |-----------|--------------------| | 16000001 | Input error. The specified ability name does not exist. | @@ -1541,13 +1519,12 @@ getOperationType(agent: WantAgent): Promise\; | 16000151 | Invalid wantagent object.| | 16000152 | wantAgent object not found.| | 16000153 | wangAgent object canceled.| +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** ```ts -import WantAgent from '@ohos.app.ability.wantAgent'; - - //wantAgent对象 +//wantAgent对象 var wantAgent; //WantAgentInfo对象 var wantAgentInfo = { diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-abilityConstant.md b/zh-cn/application-dev/reference/apis/js-apis-application-abilityConstant.md index cee27c5054fa6cf05511fa668f25f376bf2fbed1..3875625e58e9017ae2af37a4515eab02d28ecb84 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-abilityConstant.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-abilityConstant.md @@ -6,7 +6,7 @@ AbilityConstant提供启动参数的接口的能力,包括设置初次开始 > **说明:** > -> 本模块首批接口从API version 9开始支持,从API version 9废弃,替换模块为[@ohos.app.ability.AbilityConstant](js-apis-app-ability-abilityConstant.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> 本模块首批接口从API version 9开始支持,从API version 9后续版本废弃,替换模块为[@ohos.app.ability.AbilityConstant](js-apis-app-ability-abilityConstant.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块接口仅可在Stage模型下使用。 ## 导入模块 diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegatorRegistry.md b/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegatorRegistry.md index 488b266d0cff1262aea623ce5d31870d02bebb99..09717e8e556d373684f0671e14844ef713dffd04 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegatorRegistry.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegatorRegistry.md @@ -4,7 +4,7 @@ AbilityDelegatorRegistry模块提供用于存储已注册的AbilityDelegator和A > **说明:** > -> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> 本模块首批接口从API version 8开始支持,从API version 9废弃,替换模块为[@ohos.app.ability.abilityDelegatorRegistry](js-apis-app-ability-abilityDelegatorRegistry.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## 导入模块 diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md b/zh-cn/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md index 59fb80485ca99bb78d85658c9e33ba08c67fa2ee..523bb5d83c9fe44e39c4b11ac3f7e14632400a19 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md @@ -4,7 +4,7 @@ AbilityLifecycleCallback模块提供应用上下文ApplicationContext的生命 > **说明:** > -> 本模块首批接口从API version 9 开始支持,从API version 9废弃,替换模块为[@ohos.app.ability.AbilityLifecycleCallback](js-apis-app-ability-abilityLifecycleCallback.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> 本模块首批接口从API version 9 开始支持,从API version 9后续版本废弃,替换模块为[@ohos.app.ability.AbilityLifecycleCallback](js-apis-app-ability-abilityLifecycleCallback.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块接口仅可在Stage模型下使用。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-abilityManager.md b/zh-cn/application-dev/reference/apis/js-apis-application-abilityManager.md index 18509a193c3c0836190c2c595b9e0ba96ddb7fa4..c338f869071749a5c60c6920158a34ffc11f364e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-abilityManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-abilityManager.md @@ -4,13 +4,13 @@ AbilityManager模块提供对Ability相关信息和状态信息进行获取、 > **说明:** > -> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> 本模块首批接口从API version 8开始支持,从API version 9废弃,替换模块为[@ohos.app.ability.abilityManager](js-apis-app-ability-abilityManager.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块接口均为系统接口,三方应用不支持调用。 ## 导入模块 ```ts -import AbilityManager from '@ohos.application.abilityManager' +import abilityManager from '@ohos.application.abilityManager' ``` ## AbilityState @@ -49,13 +49,11 @@ updateConfiguration(config: Configuration, callback: AsyncCallback\): void **示例**: ```ts -import abilitymanager from '@ohos.application.abilityManager'; - var config = { language: 'chinese' } -abilitymanager.updateConfiguration(config, () => { +abilityManager.updateConfiguration(config, () => { console.log('------------ updateConfiguration -----------'); }) ``` @@ -85,13 +83,11 @@ updateConfiguration(config: Configuration): Promise\ **示例**: ```ts -import abilitymanager from '@ohos.application.abilityManager'; - var config = { language: 'chinese' } -abilitymanager.updateConfiguration(config).then(() => { +abilityManager.updateConfiguration(config).then(() => { console.log('updateConfiguration success'); }).catch((err) => { console.log('updateConfiguration fail'); @@ -117,9 +113,7 @@ getAbilityRunningInfos(callback: AsyncCallback\>): vo **示例**: ```ts -import abilitymanager from '@ohos.application.abilityManager'; - -abilitymanager.getAbilityRunningInfos((err,data) => { +abilityManager.getAbilityRunningInfos((err,data) => { console.log("getAbilityRunningInfos err: " + err + " data: " + JSON.stringify(data)); }); ``` @@ -143,9 +137,7 @@ getAbilityRunningInfos(): Promise\> **示例**: ```ts -import abilitymanager from '@ohos.application.abilityManager'; - -abilitymanager.getAbilityRunningInfos().then((data) => { +abilityManager.getAbilityRunningInfos().then((data) => { console.log("getAbilityRunningInfos data: " + JSON.stringify(data)) }).catch((err) => { console.log("getAbilityRunningInfos err: " + err) @@ -172,11 +164,9 @@ getExtensionRunningInfos(upperLimit: number, callback: AsyncCallback\ { +abilityManager.getExtensionRunningInfos(upperLimit, (err,data) => { console.log("getExtensionRunningInfos err: " + err + " data: " + JSON.stringify(data)); }); ``` @@ -206,11 +196,9 @@ getExtensionRunningInfos(upperLimit: number): Promise\ { +abilityManager.getExtensionRunningInfos(upperLimit).then((data) => { console.log("getAbilityRunningInfos data: " + JSON.stringify(data)); }).catch((err) => { console.log("getAbilityRunningInfos err: " + err); @@ -234,9 +222,7 @@ getTopAbility(callback: AsyncCallback\): void; **示例**: ```ts -import abilitymanager from '@ohos.application.abilityManager'; - -abilitymanager.getTopAbility((err,data) => { +abilityManager.getTopAbility((err,data) => { console.log("getTopAbility err: " + err + " data: " + JSON.stringify(data)); }); ``` @@ -258,9 +244,7 @@ getTopAbility(): Promise\; **示例**: ```ts -import abilitymanager from '@ohos.application.abilityManager'; - -abilitymanager.getTopAbility().then((data) => { +abilityManager.getTopAbility().then((data) => { console.log("getTopAbility data: " + JSON.stringify(data)); }).catch((err) => { console.log("getTopAbility err: " + err); diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-appManager.md b/zh-cn/application-dev/reference/apis/js-apis-application-appManager.md index 31360a8b4f2135f41b0429224fc3c372bae6a88a..4748a816d13c92fbd4dd9c338b29c86c7e5fe7f0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-appManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-appManager.md @@ -9,7 +9,7 @@ appManager模块提供App管理的能力,包括查询当前是否处于稳定 ## 导入模块 ```ts -import app from '@ohos.application.appManager'; +import appManager from '@ohos.application.appManager'; ``` ## appManager.isRunningInStabilityTest8+ @@ -29,9 +29,9 @@ static isRunningInStabilityTest(callback: AsyncCallback<boolean>): void **示例:** ```ts - import app from '@ohos.application.appManager'; - app.isRunningInStabilityTest((err, flag) => { - console.log('startAbility result:' + JSON.stringify(err)); + appManager.isRunningInStabilityTest((err, flag) => { + console.log('error:' + JSON.stringfy(err)); + console.log('The result of isRunningInStabilityTest is:' + JSON.stringify(flag)); }) ``` @@ -53,11 +53,10 @@ static isRunningInStabilityTest(): Promise<boolean> **示例:** ```ts - import app from '@ohos.application.appManager'; - app.isRunningInStabilityTest().then((flag) => { - console.log('success:' + JSON.stringify(flag)); + appManager.isRunningInStabilityTest().then((flag) => { + console.log('The result of isRunningInStabilityTest is:' + JSON.stringify(flag)); }).catch((error) => { - console.log('failed:' + JSON.stringify(error)); + console.log('error:' + JSON.stringify(error)); }); ``` @@ -79,10 +78,10 @@ isRamConstrainedDevice(): Promise\; **示例:** ```ts - app.isRamConstrainedDevice().then((data) => { - console.log('success:' + JSON.stringify(data)); + appManager.isRamConstrainedDevice().then((data) => { + console.log('The result of isRamConstrainedDevice is:' + JSON.stringify(data)); }).catch((error) => { - console.log('failed:' + JSON.stringify(error)); + console.log('error:' + JSON.stringify(error)); }); ``` @@ -103,9 +102,9 @@ isRamConstrainedDevice(callback: AsyncCallback\): void; **示例:** ```ts - app.isRamConstrainedDevice((err, data) => { - console.log('startAbility result failed:' + JSON.stringify(err)); - console.log('startAbility result success:' + JSON.stringify(data)); + appManager.isRamConstrainedDevice((err, data) => { + console.log('error:' + JSON.stringify(err)); + console.log('The result of isRamConstrainedDevice is:' + JSON.stringify(data)); }) ``` @@ -126,10 +125,10 @@ getAppMemorySize(): Promise\; **示例:** ```ts - app.getAppMemorySize().then((data) => { - console.log('success:' + JSON.stringify(data)); + appManager.getAppMemorySize().then((data) => { + console.log('The size of app memory is:' + JSON.stringify(data)); }).catch((error) => { - console.log('failed:' + JSON.stringify(error)); + console.log('error:' + JSON.stringify(error)); }); ``` @@ -150,9 +149,9 @@ getAppMemorySize(callback: AsyncCallback\): void; **示例:** ```ts - app.getAppMemorySize((err, data) => { - console.log('startAbility result failed :' + JSON.stringify(err)); - console.log('startAbility result success:' + JSON.stringify(data)); + appManager.getAppMemorySize((err, data) => { + console.log('error:' + JSON.stringify(err)); + console.log('The size of app memory is:' + JSON.stringify(data)); }) ``` ## appManager.getProcessRunningInfos(deprecated) @@ -176,10 +175,10 @@ getProcessRunningInfos(): Promise\>; **示例:** ```ts - app.getProcessRunningInfos().then((data) => { - console.log('success:' + JSON.stringify(data)); + appManager.getProcessRunningInfos().then((data) => { + console.log('The process running infos is:' + JSON.stringify(data)); }).catch((error) => { - console.log('failed:' + JSON.stringify(error)); + console.log('error:' + JSON.stringify(error)); }); ``` @@ -204,9 +203,9 @@ getProcessRunningInfos(callback: AsyncCallback\>): vo **示例:** ```ts - app.getProcessRunningInfos((err, data) => { - console.log('startAbility result failed :' + JSON.stringify(err)); - console.log('startAbility result success:' + JSON.stringify(data)); + appManager.getProcessRunningInfos((err, data) => { + console.log('error:' + JSON.stringify(err)); + console.log('The process running infos is:' + JSON.stringify(data)); }) ``` @@ -229,10 +228,10 @@ getProcessRunningInformation(): Promise\>; **示例:** ```ts - app.getProcessRunningInformation().then((data) => { - console.log('success:' + JSON.stringify(data)); + appManager.getProcessRunningInformation().then((data) => { + console.log('The process running info is:' + JSON.stringify(data)); }).catch((error) => { - console.log('failed:' + JSON.stringify(error)); + console.log('error:' + JSON.stringify(error)); }); ``` @@ -255,9 +254,9 @@ getProcessRunningInformation(callback: AsyncCallback\ { - console.log('startAbility result failed :' + JSON.stringify(err)); - console.log('startAbility result success:' + JSON.stringify(data)); + appManager.getProcessRunningInformation((err, data) => { + console.log('error:' + JSON.stringify(err)); + console.log('The process running info is:' + JSON.stringify(data)); }) ``` @@ -299,7 +298,7 @@ registerApplicationStateObserver(observer: ApplicationStateObserver): number; console.log('------------ onProcessStateChanged -----------', processData); } } - const observerCode = app.registerApplicationStateObserver(applicationStateObserver); + const observerCode = appManager.registerApplicationStateObserver(applicationStateObserver); console.log('-------- observerCode: ---------', observerCode); ``` @@ -343,7 +342,7 @@ registerApplicationStateObserver(observer: ApplicationStateObserver, bundleNameL } } var bundleNameList = ['bundleName1', 'bundleName2']; - const observerCode = app.registerApplicationStateObserver(applicationStateObserver, bundleNameList); + const observerCode = appManager.registerApplicationStateObserver(applicationStateObserver, bundleNameList); console.log('-------- observerCode: ---------', observerCode); ``` ## appManager.unregisterApplicationStateObserver8+ @@ -375,7 +374,7 @@ unregisterApplicationStateObserver(observerId: number, callback: AsyncCallback\ console.log('------------ unregisterApplicationStateObserverCallback ------------', err); } } - app.unregisterApplicationStateObserver(observerId, unregisterApplicationStateObserverCallback); + appManager.unregisterApplicationStateObserver(observerId, unregisterApplicationStateObserverCallback); ``` ## appManager.unregisterApplicationStateObserver8+ @@ -407,7 +406,7 @@ unregisterApplicationStateObserver(observerId: number): Promise\; ```ts var observerId = 100; - app.unregisterApplicationStateObserver(observerId) + appManager.unregisterApplicationStateObserver(observerId) .then((data) => { console.log('----------- unregisterApplicationStateObserver success ----------', data); }) @@ -444,7 +443,7 @@ getForegroundApplications(callback: AsyncCallback\>): void; console.log('--------- getForegroundApplicationsCallback success ---------', data) } } - app.getForegroundApplications(getForegroundApplicationsCallback); + appManager.getForegroundApplications(getForegroundApplicationsCallback); ``` ## appManager.getForegroundApplications8+ @@ -468,7 +467,7 @@ getForegroundApplications(): Promise\>; **示例:** ```ts - app.getForegroundApplications() + appManager.getForegroundApplications() .then((data) => { console.log('--------- getForegroundApplications success -------', data); }) @@ -501,7 +500,7 @@ killProcessWithAccount(bundleName: string, accountId: number): Promise\ ```ts var bundleName = 'bundleName'; var accountId = 0; -app.killProcessWithAccount(bundleName, accountId) +appManager.killProcessWithAccount(bundleName, accountId) .then((data) => { console.log('------------ killProcessWithAccount success ------------', data); }) @@ -543,7 +542,7 @@ function killProcessWithAccountCallback(err, data) { console.log('------------- killProcessWithAccountCallback success, data: --------------', data); } } -app.killProcessWithAccount(bundleName, accountId, killProcessWithAccountCallback); +appManager.killProcessWithAccount(bundleName, accountId, killProcessWithAccountCallback); ``` ## appManager.killProcessesByBundleName8+ @@ -576,7 +575,7 @@ killProcessesByBundleName(bundleName: string, callback: AsyncCallback\); console.log('------------- killProcessesByBundleNameCallback success, data: --------------', data); } } - app.killProcessesByBundleName(bundleName, killProcessesByBundleNameCallback); + appManager.killProcessesByBundleName(bundleName, killProcessesByBundleNameCallback); ``` ## appManager.killProcessesByBundleName8+ @@ -607,7 +606,7 @@ killProcessesByBundleName(bundleName: string): Promise\; ```ts var bundleName = 'bundleName'; - app.killProcessesByBundleName(bundleName) + appManager.killProcessesByBundleName(bundleName) .then((data) => { console.log('------------ killProcessesByBundleName success ------------', data); }) @@ -646,7 +645,7 @@ clearUpApplicationData(bundleName: string, callback: AsyncCallback\); console.log('------------- clearUpApplicationDataCallback success, data: --------------', data); } } - app.clearUpApplicationData(bundleName, clearUpApplicationDataCallback); + appManager.clearUpApplicationData(bundleName, clearUpApplicationDataCallback); ``` ## appManager.clearUpApplicationData8+ @@ -677,7 +676,7 @@ clearUpApplicationData(bundleName: string): Promise\; ```ts var bundleName = 'bundleName'; - app.clearUpApplicationData(bundleName) + appManager.clearUpApplicationData(bundleName) .then((data) => { console.log('------------ clearUpApplicationData success ------------', data); }) diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-environmentCallback.md b/zh-cn/application-dev/reference/apis/js-apis-application-environmentCallback.md index d4dcfaacf224743a145579cc9876e97f1ef5717c..f176b0456060b6c6555a72b5b7f75fbd3a847e6b 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-application-environmentCallback.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-environmentCallback.md @@ -4,7 +4,7 @@ EnvironmentCallback模块提供应用上下文ApplicationContext对系统环境 > **说明:** > -> 本模块首批接口从API version 9 开始支持,从API version 9废弃,替换模块为[@ohos.app.ability.EnvironmentCallback](js-apis-app-ability-environmentCallback.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> 本模块首批接口从API version 9 开始支持,从API version 9后续版本废弃,替换模块为[@ohos.app.ability.EnvironmentCallback](js-apis-app-ability-environmentCallback.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块接口仅可在Stage模型下使用。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-errorManager.md b/zh-cn/application-dev/reference/apis/js-apis-application-errorManager.md index 07fec114eb304e896db830f0bedfc1a59e3fb80d..f7bc2d37d02e8cdd35b57bc2b2ecbd13dc2f5469 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-errorManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-errorManager.md @@ -4,7 +4,7 @@ ErrorManager模块提供对错误观察器的注册和注销的能力。 > **说明:** > -> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> 本模块首批接口从API version 9开始支持,从API version 9后续版本废弃,替换模块为[@ohos.app.ability.errorManager](js-apis-app-ability-errorManager.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## 导入模块 ```ts diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-missionManager.md b/zh-cn/application-dev/reference/apis/js-apis-application-missionManager.md index eeb6bd1bb04c2c6f8efcdc33a67d006448821fb6..c1c63d9ac0fcf20ef902887cbc9a9637029aa22a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-missionManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-missionManager.md @@ -4,7 +4,7 @@ missionManager模块提供系统任务管理能力,包括对系统任务执行 > **说明:** > -> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> 本模块首批接口从API version 8开始支持,从API version 9废弃,替换模块为[@ohos.app.ability.missionManager](js-apis-app-ability-missionManager.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## 导入模块 diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-serviceExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-application-serviceExtensionAbility.md index 2dd73056585223bd78fc684797d31fec79e7ac6e..bf96134377e985222a90ef426d120835f9c69b84 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-serviceExtensionAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-serviceExtensionAbility.md @@ -4,7 +4,7 @@ ServiceExtensionAbility模块提供ServiceExtension服务扩展相关接口的 > **说明:** > -> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> 本模块首批接口从API version 9开始支持,从API version 9废弃,替换模块为[@ohos.app.ability.ServiceExtensionAbility](js-apis-app-ability-serviceExtensionAbility.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块接口仅可在Stage模型下使用。 ## 导入模块 diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-startOptions.md b/zh-cn/application-dev/reference/apis/js-apis-application-startOptions.md index 4582decb2918ed6f21707329d8f9384526f1577f..2aa9da070305efd9de5b200ff298569f438ac807 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-startOptions.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-startOptions.md @@ -4,7 +4,7 @@ StartOptions模块对系统的基本通信组件进行查询和设置的能力 > **说明:** > -> 本模块首批接口从API version 9 开始支持,从API version 9废弃,替换模块为[@ohos.app.ability.StartOptions](js-apis-app-ability-startOptions.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> 本模块首批接口从API version 9 开始支持,从API version 9后续版本废弃,替换模块为[@ohos.app.ability.StartOptions](js-apis-app-ability-startOptions.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块接口仅可在Stage模型下使用。 ## 导入模块 diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-want.md b/zh-cn/application-dev/reference/apis/js-apis-application-want.md index d1698794f90d41adaa1b5b19bf49527333741fb2..a5ed14139d9c559e63477c72bb768f9417c56c1f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-want.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-want.md @@ -4,7 +4,7 @@ Want是对象间信息传递的载体, 可以用于应用组件间的信息传 > **说明:** > -> 本模块首批接口从API version 8 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> 本模块首批接口从API version 8 开始支持,从API version 9废弃,替换模块为[Want](js-apis-app-ability-want.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## 导入模块