From 3e9116fc10942fcef7b7f27f5afce76f2986dabf Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Fri, 16 Sep 2022 20:42:16 +0800 Subject: [PATCH] Update docs (9266) Signed-off-by: ester.zhou --- .../reference/apis/js-apis-screen-lock.md | 26 ++- .../reference/apis/js-apis-wallpaper.md | 172 +++++++++--------- 2 files changed, 109 insertions(+), 89 deletions(-) diff --git a/en/application-dev/reference/apis/js-apis-screen-lock.md b/en/application-dev/reference/apis/js-apis-screen-lock.md index bc42373a45..d2dcd1fdd0 100644 --- a/en/application-dev/reference/apis/js-apis-screen-lock.md +++ b/en/application-dev/reference/apis/js-apis-screen-lock.md @@ -24,9 +24,10 @@ Checks whether the screen is locked. This API uses an asynchronous callback to r **System capability**: SystemCapability.MiscServices.ScreenLock **Parameters** + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | Yes| Returns **true** if the screen is locked; returns **false** otherwise.| +| callback | AsyncCallback<boolean> | Yes| Callback used to return the result. Returns **true** if the screen is locked; returns **false** otherwise.| **Example** @@ -50,6 +51,7 @@ Checks whether the screen is locked. This API uses a promise to return the resul **System capability**: SystemCapability.MiscServices.ScreenLock **Return value** + | Type| Description| | -------- | -------- | | Promise<boolean> | Promise used to return the result.| @@ -77,9 +79,10 @@ Checks whether a device is in secure mode. This API uses an asynchronous callbac **Parameters** + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | Yes| Returns **true** if the device is in secure mode; returns **false** otherwise.| +| callback | AsyncCallback<boolean> | Yes| Callback used to return the result. Returns **true** if the device is in secure mode; returns **false** otherwise.| **Example** @@ -103,6 +106,7 @@ Checks whether a device is in secure mode. This API uses a promise to return the **System capability**: SystemCapability.MiscServices.ScreenLock **Return value** + | Type| Description| | -------- | -------- | | Promise<boolean> | Promise used to return the result.| @@ -130,9 +134,10 @@ Unlocks the screen. This API uses an asynchronous callback to return the result. **Parameters** + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the operation failed, an error message is returned.| +| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the operation fails, an error message is returned.| **Example** @@ -156,6 +161,7 @@ Unlocks the screen. This API uses a promise to return the result. **System capability**: SystemCapability.MiscServices.ScreenLock **Return value** + | Type| Description| | -------- | -------- | | Promise<void> | Promise used to return the result.| @@ -173,7 +179,7 @@ Unlocks the screen. This API uses a promise to return the result. ## screenlock.lockScreen9+ -lockScreen(callback: AsyncCallback<void>): void +lockScreen(callback: AsyncCallback<boolean>): void Locks the screen. This API uses an asynchronous callback to return the result. @@ -184,9 +190,10 @@ Locks the screen. This API uses an asynchronous callback to return the result. **System API**: This is a system API and cannot be called by third-party applications. **Parameters** + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the operation failed, an error message is returned.| +| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the operation fails, an error message is returned.| **Example** @@ -202,7 +209,7 @@ Locks the screen. This API uses an asynchronous callback to return the result. ## screenlock.lockScreen9+ -lockScreen(): Promise<void> +lockScreen(): Promise<boolean> Locks the screen. This API uses a promise to return the result. @@ -238,6 +245,7 @@ Subscribes to screen lock status changes. **System API**: This is a system API and cannot be called by third-party applications. **Parameters** + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type.
- **"beginWakeUp"**: Wakeup starts.
- **"endWakeUp"**: Wakeup ends.
- **"beginScreenOn"**: Screen turn-on starts.
- **"endScreenOn"**: Screen turn-on ends.
- **"beginScreenOff"**: Screen turn-off starts.
- **"endScreenOff"**: Screen turn-off ends.
- **"unlockScreen"**: The screen is unlocked.
- **"beginExitAnimation"**: Animation starts to exit.| @@ -262,6 +270,7 @@ Subscribes to screen lock status changes. **System API**: This is a system API and cannot be called by third-party applications. **Parameters** + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type.
- **"beginSleep"**: The screen enters sleep mode.
- **"endSleep"**: The screen exits sleep mode.
- **"changeUser"**: The user is switched.| @@ -285,6 +294,7 @@ Subscribes to screen lock status changes. **System API**: This is a system API and cannot be called by third-party applications. **Parameters** + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type.
- **"screenlockEnabled"**: Screen lock is enabled.| @@ -310,6 +320,7 @@ Unsubscribes from screen lock status changes. **System API**: This is a system API and cannot be called by third-party applications. **Parameters** + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type.
- **"beginWakeUp"**: Wakeup starts.
- **"endWakeUp"**: Wakeup ends.
- **"beginScreenOn"**: Screen turn-on starts.
- **"endScreenOn"**: Screen turn-on ends.
- **"beginScreenOff"**: Screen turn-off starts.
- **"endScreenOff"**: Screen turn-off ends.
- **"unlockScreen"**: The screen is unlocked.
- **"beginExitAnimation"**: Animation starts to exit.
- **"screenlockEnabled"**: Screen lock is enabled.
- **"beginSleep"**: The screen enters sleep mode.
- **"endSleep"**: The screen exits sleep mode.
- **"changeUser"**: The user is switched.| @@ -334,6 +345,7 @@ Sends an event to the screen lock service. This API uses an asynchronous callbac **System API**: This is a system API and cannot be called by third-party applications. **Parameters** + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | event | String | Yes| Event type.
- **"unlockScreenResult"**: Screen unlock result.
- **"screenDrawDone"**: Screen drawing is complete.| @@ -359,12 +371,14 @@ Sends an event to the screen lock service. This API uses a promise to return the **System API**: This is a system API and cannot be called by third-party applications. **Parameters** + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | event | String | Yes| Event type.
- **"unlockScreenResult"**: Screen unlock result.
- **"screenDrawDone"**: Screen drawing is complete.| | parameter | number | Yes| Screen unlock status.
- **0**: The unlock is successful.
- **1**: The unlock failed.
- **2**: The unlock was canceled.| **Return value** + | Type| Description| | -------- | -------- | | Promise\ | Promise used to return the result.| diff --git a/en/application-dev/reference/apis/js-apis-wallpaper.md b/en/application-dev/reference/apis/js-apis-wallpaper.md index 2eae3ec8e5..8c6ca80a61 100644 --- a/en/application-dev/reference/apis/js-apis-wallpaper.md +++ b/en/application-dev/reference/apis/js-apis-wallpaper.md @@ -21,10 +21,10 @@ Defines the wallpaper type. **System capability**: SystemCapability.MiscServices.Wallpaper -| Name | Description | +| Name| Description| | -------- | -------- | -| WALLPAPER_LOCKSCREEN | Lock screen wallpaper. | -| WALLPAPER_SYSTEM | Home screen wallpaper. | +| WALLPAPER_LOCKSCREEN | Lock screen wallpaper.| +| WALLPAPER_SYSTEM | Home screen wallpaper.| ## wallpaper.getColors @@ -36,10 +36,11 @@ Obtains the main color information of the wallpaper of the specified type. This **System capability**: SystemCapability.MiscServices.Wallpaper **Parameters** -| Name | Type | Mandatory | Description | + +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes | Wallpaper type. | -| callback | AsyncCallback<Array<[RgbaColor](#rgbacolor)>> | Yes | Callback used to return the main color information of the wallpaper. | +| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| callback | AsyncCallback<Array<[RgbaColor](#rgbacolor)>> | Yes| Callback used to return the main color information of the wallpaper.| **Example** @@ -64,15 +65,15 @@ Obtains the main color information of the wallpaper of the specified type. This **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes | Wallpaper type. | +| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| **Return value** -| Type | Description | +| Type| Description| | -------- | -------- | -| Promise<Array<[RgbaColor](#rgbacolor)>> | Promise used to return the main color information of the wallpaper. | +| Promise<Array<[RgbaColor](#rgbacolor)>> | Promise used to return the main color information of the wallpaper.| **Example** @@ -95,10 +96,10 @@ Obtains the ID of the wallpaper of the specified type. This API uses an asynchro **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes | Wallpaper type. | -| callback | AsyncCallback<number> | Yes | Callback used to return the wallpaper ID. If the wallpaper of the specified type is configured, a number greater than or equal to **0** is returned. Otherwise, **-1** is returned. The value ranges from -1 to 2^31-1. | +| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| callback | AsyncCallback<number> | Yes| Callback used to return the wallpaper ID. If the wallpaper of the specified type is configured, a number greater than or equal to **0** is returned. Otherwise, **-1** is returned. The value ranges from -1 to 2^31-1.| **Example** @@ -124,15 +125,15 @@ Obtains the ID of the wallpaper of the specified type. This API uses a promise t **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes | Wallpaper type. | +| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| **Return value** -| Type | Description | +| Type| Description| | -------- | -------- | -| Promise<number> | Promise used to return the wallpaper ID. If this type of wallpaper is configured, a number greater than or equal to **0** is returned. Otherwise, **-1** is returned. The value ranges from -1 to 2^31-1. | +| Promise<number> | Promise used to return the wallpaper ID. If this type of wallpaper is configured, a number greater than or equal to **0** is returned. Otherwise, **-1** is returned. The value ranges from -1 to 2^31-1.| **Example** @@ -155,9 +156,9 @@ Obtains the minimum height of this wallpaper. This API uses an asynchronous call **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | AsyncCallback<number> | Yes | Callback used to return the minimum wallpaper height, in pixels. If the return value is **0**, no wallpaper is set. In this case, the default height should be used instead. | +| callback | AsyncCallback<number> | Yes| Callback used to return the minimum wallpaper height, in pixels. If the return value is **0**, no wallpaper is set. In this case, the default height should be used instead.| **Example** @@ -183,9 +184,9 @@ Obtains the minimum height of this wallpaper. This API uses a promise to return **Return value** -| Type | Description | +| Type| Description| | -------- | -------- | -| Promise<number> | Promise used to return the minimum wallpaper height, in pixels. If the return value is **0**, no wallpaper is set. In this case, the default height should be used instead. | +| Promise<number> | Promise used to return the minimum wallpaper height, in pixels. If the return value is **0**, no wallpaper is set. In this case, the default height should be used instead.| **Example** @@ -206,11 +207,12 @@ Obtains the minimum width of this wallpaper. This API uses an asynchronous callb **System capability**: SystemCapability.MiscServices.Wallpaper + **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | AsyncCallback<number> | Yes | Callback used to return the minimum wallpaper width, in pixels. If the return value is **0**, no wallpaper is set. In this case, the default width should be used instead. | +| callback | AsyncCallback<number> | Yes| Callback used to return the minimum wallpaper width, in pixels. If the return value is **0**, no wallpaper is set. In this case, the default width should be used instead.| **Example** @@ -235,9 +237,9 @@ Obtains the minimum width of this wallpaper. This API uses a promise to return t **Return value** -| Type | Description | +| Type| Description| | -------- | -------- | -| Promise<number> | Promised used to return the minimum wallpaper width, in pixels. If the return value is **0**, no wallpaper is set. In this case, the default width should be used instead. | +| Promise<number> | Promised used to return the minimum wallpaper width, in pixels. If the return value is **0**, no wallpaper is set. In this case, the default width should be used instead.| **Example** @@ -260,9 +262,9 @@ Checks whether to allow the application to change the wallpaper for the current **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | Yes | Returns **true** if the application is allowed to change the wallpaper for the current user; returns **false** otherwise. | +| callback | AsyncCallback<boolean> | Yes| Callback used to return the result. Returns **true** if the application is allowed to change the wallpaper for the current user; returns **false** otherwise.| **Example** @@ -287,9 +289,9 @@ Checks whether to allow the application to change the wallpaper for the current **Return value** -| Type | Description | +| Type| Description| | -------- | -------- | -| Promise<boolean> | Returns **true** if the application is allowed to change the wallpaper for the current user; returns **false** otherwise. | +| Promise<boolean> | Promise used to return the result. Returns **true** if the application is allowed to change the wallpaper for the current user; returns **false** otherwise.| **Example** @@ -312,9 +314,9 @@ Checks whether the user is allowed to set wallpapers. This API uses an asynchron **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | Yes | Returns **true** if the user is allowed to set wallpapers; returns **false** otherwise. | +| callback | AsyncCallback<boolean> | Yes| Callback used to return the result. Returns **true** if the user is allowed to set wallpapers; returns **false** otherwise.| **Example** @@ -339,9 +341,9 @@ Checks whether the user is allowed to set wallpapers. This API uses a promise to **Return value** -| Type | Description | +| Type| Description| | -------- | -------- | -| Promise<boolean> | Returns **true** if the user is allowed to set wallpapers; returns **false** otherwise. | +| Promise<boolean> | Promise used to return the result. Returns **true** if the user is allowed to set wallpapers; returns **false** otherwise.| **Example** @@ -366,10 +368,10 @@ Resets the wallpaper of the specified type to the default wallpaper. This API us **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes | Wallpaper type. | -| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the operation is successful, the result is returned. Otherwise, error information is returned. | +| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the operation is successful, the result of removal is returned. Otherwise, error information is returned.| **Example** @@ -396,15 +398,15 @@ Resets the wallpaper of the specified type to the default wallpaper. This API us **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes | Wallpaper type. | +| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| **Return value** -| Type | Description | +| Type| Description| | -------- | -------- | -| Promise<void> | Promise used to return the result. If the operation is successful, the result is returned. Otherwise, error information is returned. | +| Promise<void> | Promise used to return the result. If the operation is successful, the result is returned. Otherwise, error information is returned.| **Example** @@ -429,16 +431,16 @@ Sets a specified source as the wallpaper of a specified type. This API uses an a **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| source | string \| [PixelMap](js-apis-image.md#pixelmap7) | Yes | URI of a JPEG or PNG file, or bitmap of a PNG file. | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes | Wallpaper type. | -| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the operation is successful, the setting result is returned. Otherwise, error information is returned. | +| source | string \|[PixelMap](js-apis-image.md#pixelmap7) | | URI of a JPEG or PNG file, or bitmap of a PNG file.| +| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the operation is successful, the setting result is returned. Otherwise, error information is returned.| **Example** -```js -// The source type is string. + ```js + //The source type is string. let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg"; wallpaper.setWallpaper(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error, data) => { if (error) { @@ -448,7 +450,7 @@ Sets a specified source as the wallpaper of a specified type. This API uses an a console.log(`success to setWallpaper.`); }); -// The source type is image.PixelMap. + // The source type is image.PixelMap. import image from '@ohos.multimedia.image'; let imageSource = image.createImageSource("file://" + wallpaperPath); let opts = { @@ -468,7 +470,7 @@ Sets a specified source as the wallpaper of a specified type. This API uses an a }).catch((error) => { console.error(`failed to createPixelMap because: ` + JSON.stringify(error)); }); -``` + ``` ## wallpaper.setWallpaper @@ -483,21 +485,21 @@ Sets a specified source as the wallpaper of a specified type. This API uses a pr **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| source | string \| [PixelMap](js-apis-image.md#pixelmap7) | Yes | URI path of the JPEG or PNG file, or bitmap of the PNG file. | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes | Wallpaper type. | +| source | string \|[PixelMap](js-apis-image.md#pixelmap7) | Yes| URI of a JPEG or PNG file, or bitmap of a PNG file.| +| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| **Return value** -| Type | Description | +| Type| Description| | -------- | -------- | -| Promise<void> | Promise used to return the result. If the operation is successful, the setting result is returned. Otherwise, error information is returned. | +| Promise<void> | Promise used to return the result. If the operation is successful, the setting result is returned. Otherwise, error information is returned.| **Example** -```js -// The source type is string. + ```js + // The source type is string. let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg"; wallpaper.setWallpaper(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => { console.log(`success to setWallpaper.`); @@ -505,7 +507,7 @@ Sets a specified source as the wallpaper of a specified type. This API uses a pr console.error(`failed to setWallpaper because: ` + JSON.stringify(error)); }); -// The source type is image.PixelMap. + // The source type is image.PixelMap. import image from '@ohos.multimedia.image'; let imageSource = image.createImageSource("file://" + wallpaperPath); let opts = { @@ -523,7 +525,7 @@ Sets a specified source as the wallpaper of a specified type. This API uses a pr }).catch((error) => { console.error(`failed to createPixelMap because: ` + JSON.stringify(error)); }); -``` + ``` ## wallpaper.getFile8+ @@ -537,10 +539,10 @@ Obtains the wallpaper of the specified type. This API uses an asynchronous callb **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes | Wallpaper type. | -| callback | AsyncCallback<number> | Yes | Callback used to return the result. If the operation is successful, the file descriptor ID to the wallpaper is returned. Otherwise, error information is returned. | +| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| callback | AsyncCallback<number> | Yes| Callback used to return the result. If the operation is successful, the file descriptor ID to the wallpaper is returned. Otherwise, error information is returned.| **Example** @@ -566,15 +568,15 @@ Obtains the wallpaper of the specified type. This API uses a promise to return t **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes | Wallpaper type. | +| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| **Return value** -| Type | Description | +| Type| Description| | -------- | -------- | -| Promise<number> | Promise used to return the result. If the operation is successful, the file descriptor ID to the wallpaper is returned. Otherwise, error information is returned. | +| Promise<number> | Promise used to return the result. If the operation is successful, the file descriptor ID to the wallpaper is returned. Otherwise, error information is returned.| **Example** @@ -591,18 +593,20 @@ Obtains the wallpaper of the specified type. This API uses a promise to return t getPixelMap(wallpaperType: WallpaperType, callback: AsyncCallback<image.PixelMap>): void; -Obtains the pixel image for the wallpaper of the specified type. This API uses an asynchronous callback to return the result. +Obtains the pixel map for the wallpaper of the specified type. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.GET_WALLPAPER **System capability**: SystemCapability.MiscServices.Wallpaper +**System API**: This is a system API and cannot be called by third-party applications. + **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| -| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the operation is successful, the result is returned. Otherwise, error information is returned.| +| callback | AsyncCallback<void> | Yes| Callback used to return the result. Returns the pixel map size of the wallpaper if the operation is successful; returns an error message otherwise.| **Example** @@ -618,12 +622,14 @@ Obtains the pixel image for the wallpaper of the specified type. This API uses a getPixelMap(wallpaperType: WallpaperType): Promise<image.PixelMap> -Obtains the pixel image for the wallpaper of the specified type. This API uses a promise to return the result. +Obtains the pixel map for the wallpaper of the specified type. This API uses a promise to return the result. **Required permissions**: ohos.permission.GET_WALLPAPER **System capability**: SystemCapability.MiscServices.Wallpaper +**System API**: This is a system API and cannot be called by third-party applications. + **Parameters** | Name| Type| Mandatory| Description| @@ -634,7 +640,7 @@ Obtains the pixel image for the wallpaper of the specified type. This API uses a | Type| Description| | -------- | -------- | -| Promise<void> | Promise used to return the result. If the operation is successful, the result is returned. Otherwise, error information is returned.| +| Promise<void> | Promise used to return the result. Returns the pixel map size of the wallpaper if the operation is successful; returns an error message otherwise.| **Example** @@ -659,10 +665,10 @@ Subscribes to the wallpaper color change event. **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| type | string | Yes | Type of the event to subscribe to. The value **colorChange** indicates subscribing to the wallpaper color change event. | -| callback | function | Yes | Callback triggered when the wallpaper color changes. The wallpaper type and main colors are returned.
- colors
Main color information of the wallpaper. For details, see [RgbaColor](#rgbacolor).
- wallpaperType
Wallpaper type. | +| type | string | Yes| Type of the event to subscribe to. The value **'colorChange'** indicates subscribing to the wallpaper color change event.| +| callback | function | Yes| Callback triggered when the wallpaper color changes. The wallpaper type and main colors are returned.
- colors
Main color information of the wallpaper. For details, see [RgbaColor](#rgbacolor).
- wallpaperType
Wallpaper type.| **Example** @@ -684,10 +690,10 @@ Unsubscribes from the wallpaper color change event. **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| type | string | Yes | Type of the event to unsubscribe from. The value **colorChange** indicates unsubscribing from the wallpaper color change event. | -| callback | function | No | Callback for the wallpaper color change event. If this parameter is not specified, all callbacks corresponding to the wallpaper color change event are invoked.
- colors
Main color information of the wallpaper. For details, see [RgbaColor](#rgbacolor).
- wallpaperType
Wallpaper type. | +| type | string | Yes| Type of the event to unsubscribe from. The value **colorChange** indicates unsubscribing from the wallpaper color change event.| +| callback | function | No| Callback for the wallpaper color change event. If this parameter is not specified, all callbacks corresponding to the wallpaper color change event are invoked.
- colors
Main color information of the wallpaper. For details, see [RgbaColor](#rgbacolor).
- wallpaperType
Wallpaper type.| **Example** @@ -696,10 +702,10 @@ Unsubscribes from the wallpaper color change event. console.log(`wallpaper color changed.`); }; wallpaper.on('colorChange', listener); -// Unsubscribe from the listener. -wallpaper.off('colorChange', listener); -// Unsubscribe from all subscriptions of the colorChange type. -wallpaper.off('colorChange'); + // Unsubscribe from the listener. + wallpaper.off('colorChange', listener); + // Unsubscribe from all subscriptions of the colorChange type. + wallpaper.off('colorChange'); ``` @@ -707,9 +713,9 @@ wallpaper.off('colorChange'); **System capability**: SystemCapability.MiscServices.Wallpaper -| Name | Type | Readable | Writable | Description | +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| red | number | Yes | Yes | Red color. The value ranges from 0 to 255. | -| green | number | Yes | Yes | Green color. The value ranges from 0 to 255. | -| blue | number | Yes | Yes | Blue color. The value ranges from 0 to 255. | -| alpha | number | Yes | Yes | Alpha value. The value ranges from 0 to 255. | +| red | number | Yes| Yes| Red color. The value ranges from 0 to 255.| +| green | number | Yes| Yes| Green color. The value ranges from 0 to 255.| +| blue | number | Yes| Yes| Blue color. The value ranges from 0 to 255.| +| alpha | number | Yes| Yes| Alpha value. The value ranges from 0 to 255.| -- GitLab