From 5d509c839fe41eb43708fbfbf8b23d0adff8aad1 Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Fri, 21 Jul 2023 18:01:23 +0800 Subject: [PATCH] Update docs (20324) Signed-off-by: ester.zhou --- .../apis/js-apis-WallpaperExtensionAbility.md | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 en/application-dev/reference/apis/js-apis-WallpaperExtensionAbility.md diff --git a/en/application-dev/reference/apis/js-apis-WallpaperExtensionAbility.md b/en/application-dev/reference/apis/js-apis-WallpaperExtensionAbility.md new file mode 100644 index 0000000000..ff4eca1ad3 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-WallpaperExtensionAbility.md @@ -0,0 +1,89 @@ +# @ohos.WallpaperExtensionAbility (WallpaperExtensionAbility) + +The **WallpaperExtensionAbility** module provides APIs for developing wallpaper extension abilities and managing the lifecycle of these extension abilities. + +> **NOTE** +> +> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> +> The APIs of this module can be used only in the FA model. +> +> The APIs provided by this module are system APIs. + +## Modules to Import + +```js +import WallpaperExtensionAbility from '@ohos.WallpaperExtensionAbility'; +``` + +## WallpaperExtensionAbility.onCreate + +onCreate(want: object): void + +Called to initialize a wallpaper extension ability when it is launched. + +**System capability**: SystemCapability.MiscServices.Wallpaper + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ----------- | ---- | ------------------------------- | +| want | [object](js-apis-app-ability-want.md) | Yes | Want information related to the wallpaper extension ability, including the ability name and bundle name.| + +**Example** + +```js +import WallpaperExtensionAbility from '@ohos.WallpaperExtensionAbility'; + +class WallpaperExt extends WallpaperExtensionAbility { + onCreate(want) { + console.log('onCreate, want:' + want.abilityName); + } +} +``` + +## WallpaperExtensionAbility.onWallpaperChange + +onWallpaperChange(wallpaperType: number): void + +Called when the wallpaper changes. + +**System capability**: SystemCapability.MiscServices.Wallpaper + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | --------- | --- |----------------------| +| wallpaperType | number | Yes | Wallpaper type. **0**: home screen wallpaper.
**1**: lock screen wallpaper.| + +**Example** + +```js +import WallpaperExtensionAbility from '@ohos.WallpaperExtensionAbility'; + +class WallpaperExt extends WallpaperExtensionAbility { + onWallpaperChange(wallpaperType) { + console.log('onWallpaperChange, wallpaperType:' + wallpaperType); + } +} +``` + +## WallpaperExtensionAbility.onDestroy + +onDestroy(): void + +Called when this wallpaper extension ability is destroyed to clear resources. + +**System capability**: SystemCapability.MiscServices.Wallpaper + +**Example** + +```js +import WallpaperExtensionAbility from '@ohos.WallpaperExtensionAbility'; + +class WallpaperExt extends WallpaperExtensionAbility { + onDestroy() { + console.log('onDestroy'); + } +} +``` -- GitLab