diff --git a/en/application-dev/reference/apis/js-apis-Context.md b/en/application-dev/reference/apis/js-apis-Context.md index dc2f0ef50ad05bc74b3e7ba301c421dfc3dae741..116af9c40bdb3c13cc278a13bb7ae5b08330095f 100644 --- a/en/application-dev/reference/apis/js-apis-Context.md +++ b/en/application-dev/reference/apis/js-apis-Context.md @@ -381,6 +381,53 @@ context.getDisplayOrientation().then((data) => { }); ``` +## Context.getExternalCacheDir + +getExternalCacheDir(callback: AsyncCallback\): void + +Obtains the external cache directory of the application. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------- | ---- | ------------------ | +| callback | AsyncCallback\ | Yes | Callback used to return the absolute path of the cache directory.| + +**Example** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +context.getExternalCacheDir() +``` + +## Context.getExternalCacheDir + +getExternalCacheDir(): Promise\; + +Obtains the external cache directory of the application. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Return value** + +| Type | Description | +| ---------------- | ---------------- | +| Promise\ | Promise used to return the absolute path of the cache directory.| + +**Example** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +context.getExternalCacheDir().then((data) => { + console.info("=======================>getExternalCacheDirCallback====================>"); + console.info("====>data====>" + JSON.stringify(data)); +}); +``` + ## Context.setDisplayOrientation7+ setDisplayOrientation(orientation: bundle.DisplayOrientation, callback: AsyncCallback\): void