From 4978b75bcd96ec98bcaca4bb6a8f20434c210dbb Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Thu, 19 Jan 2023 12:43:53 +0800 Subject: [PATCH] Update docs (12508) Signed-off-by: ester.zhou --- .../faqs/faqs-development-board.md | 6 +- .../apis/js-apis-accessibility-GesturePath.md | 2 +- .../js-apis-accessibility-GesturePoint.md | 4 +- .../apis/js-apis-accessibility-config.md | 2 +- .../reference/apis/js-apis-accessibility.md | 2 +- .../reference/apis/js-apis-animator.md | 4 +- .../reference/apis/js-apis-curve.md | 2 +- .../reference/apis/js-apis-device-info.md | 5 +- .../js-apis-enterprise-dateTimeManager.md | 2 +- .../reference/apis/js-apis-environment.md | 2 +- .../js-apis-inputmethod-extension-ability.md | 2 +- .../apis/js-apis-inputmethod-subtype.md | 2 +- .../reference/apis/js-apis-inputmethod.md | 2 +- .../apis/js-apis-inputmethodengine.md | 2 +- .../reference/apis/js-apis-matrix4.md | 2 +- .../reference/apis/js-apis-mediaquery.md | 2 +- .../reference/apis/js-apis-pasteboard.md | 56 ++-- .../reference/apis/js-apis-prompt.md | 2 +- .../reference/apis/js-apis-promptAction.md | 2 +- .../reference/apis/js-apis-router.md | 2 +- .../reference/apis/js-apis-settings.md | 2 +- .../apis/js-apis-system-date-time.md | 274 ++++++++--------- .../reference/apis/js-apis-system-device.md | 2 +- .../apis/js-apis-system-mediaquery.md | 12 +- .../apis/js-apis-system-parameter.md | 2 +- .../apis/js-apis-system-parameterV9.md | 2 +- .../reference/apis/js-apis-system-prompt.md | 4 +- .../reference/apis/js-apis-system-router.md | 2 +- .../reference/apis/js-apis-system-timer.md | 284 +++++++++--------- .../reference/apis/js-apis-uitest.md | 2 +- .../reference/apis/js-apis-wallpaper.md | 2 +- .../reference/apis/js-apis-webview.md | 4 +- 32 files changed, 349 insertions(+), 348 deletions(-) diff --git a/en/application-dev/faqs/faqs-development-board.md b/en/application-dev/faqs/faqs-development-board.md index 79e5fc390f..0a2a29db5b 100644 --- a/en/application-dev/faqs/faqs-development-board.md +++ b/en/application-dev/faqs/faqs-development-board.md @@ -9,7 +9,6 @@ Applicable to: OpenHarmony SDK 3.2.2.5, stage model of API version 9 - Method 2: Run the screenshot script. Connect to the development board to a computer running Windows. Create a text file on the computer, copy the following script content to the file, change the file name extension to **.bat** (the HDC environment variables must be configured in advance), and click **Run**. The screenshot is saved to the same directory as the **.bat** script file. Example: - ``` set filepath=/data/%date:~0,4%%date:~5,2%%date:~8,2%%time:~1,1%%time:~3,2%%time:~6,2%.png echo %filepath% @@ -29,10 +28,11 @@ Applicable to: DevEco Studio 3.0.0.991 ![en-us_image_0000001361254285](figures/en-us_image_0000001361254285.png) 2. Set the profile parameters as follows: + Device type : default - + Resolution: 720\*1280 - + DPI: 240 ## What should I do if Device Manager incorrectly identifies a development board as FT232R USB UART even when the development board already has a driver installed? diff --git a/en/application-dev/reference/apis/js-apis-accessibility-GesturePath.md b/en/application-dev/reference/apis/js-apis-accessibility-GesturePath.md index 34d4df8dd9..8de8db11bb 100644 --- a/en/application-dev/reference/apis/js-apis-accessibility-GesturePath.md +++ b/en/application-dev/reference/apis/js-apis-accessibility-GesturePath.md @@ -1,4 +1,4 @@ -# @ohos.accessibility.GesturePath +# @ohos.accessibility.GesturePath (Gesture Path) The **GesturePath** module provides APIs for creating gesture path information required for an accessibility application to inject gestures. diff --git a/en/application-dev/reference/apis/js-apis-accessibility-GesturePoint.md b/en/application-dev/reference/apis/js-apis-accessibility-GesturePoint.md index 5792c44cd9..f6923044ff 100644 --- a/en/application-dev/reference/apis/js-apis-accessibility-GesturePoint.md +++ b/en/application-dev/reference/apis/js-apis-accessibility-GesturePoint.md @@ -1,6 +1,6 @@ -# @ohos.accessibility.GesturePoint +# @ohos.accessibility.GesturePoint (Gesture Point) - The **GesturePoint** module provides APIs for creating gesture touch point information required for an accessibility application to inject gestures. +The **GesturePoint** module provides APIs for creating gesture touch point information required for an accessibility application to inject gestures. > **NOTE** > diff --git a/en/application-dev/reference/apis/js-apis-accessibility-config.md b/en/application-dev/reference/apis/js-apis-accessibility-config.md index 33b6f58627..673d820d17 100644 --- a/en/application-dev/reference/apis/js-apis-accessibility-config.md +++ b/en/application-dev/reference/apis/js-apis-accessibility-config.md @@ -1,4 +1,4 @@ -# @ohos.accessibility.config +# @ohos.accessibility.config (System Accessibility Configuration) The System Accessibility Configuration module allows you to configure system accessibility features, including accessibility extension, high-contrast text, mouse buttons, and captions. diff --git a/en/application-dev/reference/apis/js-apis-accessibility.md b/en/application-dev/reference/apis/js-apis-accessibility.md index cf4443c60f..8121b906b8 100644 --- a/en/application-dev/reference/apis/js-apis-accessibility.md +++ b/en/application-dev/reference/apis/js-apis-accessibility.md @@ -1,4 +1,4 @@ -# @ohos.accessibility +# @ohos.accessibility (Accessibility) The **Accessibility** module implements the accessibility functions, including obtaining the accessibility application list, accessibility application enabled status, and captions configuration. diff --git a/en/application-dev/reference/apis/js-apis-animator.md b/en/application-dev/reference/apis/js-apis-animator.md index da7ec7d145..b0bfec0f18 100644 --- a/en/application-dev/reference/apis/js-apis-animator.md +++ b/en/application-dev/reference/apis/js-apis-animator.md @@ -1,6 +1,6 @@ -# @ohos.animator +# @ohos.animator (Animator) -The **animator** module provides APIs for applying animation effects, including defining animations, starting animations, and playing animations in reverse order. +The **Animator** module provides APIs for applying animation effects, including defining animations, starting animations, and playing animations in reverse order. > **NOTE** > diff --git a/en/application-dev/reference/apis/js-apis-curve.md b/en/application-dev/reference/apis/js-apis-curve.md index 2c90472a98..cf3067e37f 100644 --- a/en/application-dev/reference/apis/js-apis-curve.md +++ b/en/application-dev/reference/apis/js-apis-curve.md @@ -1,4 +1,4 @@ -# @ohos.curves +# @ohos.curves (Interpolation Calculation) The **Curves** module provides APIs for interpolation calculation to create step, cubic Bezier, and spring curves. diff --git a/en/application-dev/reference/apis/js-apis-device-info.md b/en/application-dev/reference/apis/js-apis-device-info.md index d413556b36..2827737f79 100644 --- a/en/application-dev/reference/apis/js-apis-device-info.md +++ b/en/application-dev/reference/apis/js-apis-device-info.md @@ -1,8 +1,9 @@ -# @ohos.deviceInfo +# @ohos.deviceInfo (Device Information) The **deviceInfo** module provides product information. -> **NOTE**
+> **NOTE** +> > The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import diff --git a/en/application-dev/reference/apis/js-apis-enterprise-dateTimeManager.md b/en/application-dev/reference/apis/js-apis-enterprise-dateTimeManager.md index bc28cffaa5..009c9ede29 100644 --- a/en/application-dev/reference/apis/js-apis-enterprise-dateTimeManager.md +++ b/en/application-dev/reference/apis/js-apis-enterprise-dateTimeManager.md @@ -1,4 +1,4 @@ -# @ohos.enterprise.dateTimeManager +# @ohos.enterprise.dateTimeManager (System Time Management) The **dateTimeManager** module provides APIs for system time management, which can only be called by device administrator applications. diff --git a/en/application-dev/reference/apis/js-apis-environment.md b/en/application-dev/reference/apis/js-apis-environment.md index 3f879c77b9..aca809efc2 100644 --- a/en/application-dev/reference/apis/js-apis-environment.md +++ b/en/application-dev/reference/apis/js-apis-environment.md @@ -1,4 +1,4 @@ -# Environment +# @ohos.environment (Directory Environment Capability) The **Environment** module provides APIs for obtaining the root directories of the storage and public files. diff --git a/en/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md b/en/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md index 6a8cabde03..d96cd241e7 100644 --- a/en/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md +++ b/en/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md @@ -1,4 +1,4 @@ -# InputMethodExtensionAbility +# @ohos.inputmethodextensionability (InputMethodExtensionAbility) The **InputMethodExtensionAbility** module provides APIs for developing input methods and managing their lifecycles. diff --git a/en/application-dev/reference/apis/js-apis-inputmethod-subtype.md b/en/application-dev/reference/apis/js-apis-inputmethod-subtype.md index 61ec49997c..1b5f9dfb66 100644 --- a/en/application-dev/reference/apis/js-apis-inputmethod-subtype.md +++ b/en/application-dev/reference/apis/js-apis-inputmethod-subtype.md @@ -1,4 +1,4 @@ -# @ohos.inputmethodsubtype +# @ohos.inputmethodsubtype (Input Method Subtype) The **inputMethodSubtype** module provides APIs for managing the attributes of input method subtypes. Different attribute settings result in different subtypes. diff --git a/en/application-dev/reference/apis/js-apis-inputmethod.md b/en/application-dev/reference/apis/js-apis-inputmethod.md index 424e48b357..e7ff69abcf 100644 --- a/en/application-dev/reference/apis/js-apis-inputmethod.md +++ b/en/application-dev/reference/apis/js-apis-inputmethod.md @@ -1,4 +1,4 @@ -# @ohos.inputmethod +# @ohos.inputmethod (Input Method Framework) The **inputMethod** module provides an input method framework, which can be used to hide the keyboard, obtain the list of installed input methods, display the dialog box for input method selection, and more. diff --git a/en/application-dev/reference/apis/js-apis-inputmethodengine.md b/en/application-dev/reference/apis/js-apis-inputmethodengine.md index 2c87f74698..f5becc73ca 100644 --- a/en/application-dev/reference/apis/js-apis-inputmethodengine.md +++ b/en/application-dev/reference/apis/js-apis-inputmethodengine.md @@ -1,4 +1,4 @@ -# @ohos.inputmethodengine +# @ohos.inputmethodengine (Input Method Service) The **inputMethodEngine** module streamlines the interaction between input methods and applications. By calling APIs of this module, applications can be bound to input method services to accept text input through the input methods, request the keyboard to display or hide, listen for the input method status, and much more. diff --git a/en/application-dev/reference/apis/js-apis-matrix4.md b/en/application-dev/reference/apis/js-apis-matrix4.md index f5b9b27f55..057e05ac3f 100644 --- a/en/application-dev/reference/apis/js-apis-matrix4.md +++ b/en/application-dev/reference/apis/js-apis-matrix4.md @@ -1,4 +1,4 @@ -# @ohos.matrix4 +# @ohos.matrix4 (Matrix Transformation) The **matrix4** module provides APIs for matrix transformation. You can use these APIs to translate, rotate, and scale images. diff --git a/en/application-dev/reference/apis/js-apis-mediaquery.md b/en/application-dev/reference/apis/js-apis-mediaquery.md index f44a0801b9..eb17dcdd6d 100644 --- a/en/application-dev/reference/apis/js-apis-mediaquery.md +++ b/en/application-dev/reference/apis/js-apis-mediaquery.md @@ -1,4 +1,4 @@ -# @ohos.mediaquery +# @ohos.mediaquery (Media Query) The **mediaquery** module provides different styles for different media types. diff --git a/en/application-dev/reference/apis/js-apis-pasteboard.md b/en/application-dev/reference/apis/js-apis-pasteboard.md index ee53667d01..d1d554f677 100644 --- a/en/application-dev/reference/apis/js-apis-pasteboard.md +++ b/en/application-dev/reference/apis/js-apis-pasteboard.md @@ -1,4 +1,4 @@ -# Pasteboard +# @ohos.pasteboard (Pasteboard) The **pasteboard** module provides the copy and paste support for the system pasteboard. You can use the APIs of this module to operate pasteboard content of the plain text, HTML, URI, Want, pixel map, and other types. @@ -120,11 +120,11 @@ Enumerates the paste options of data. **System capability**: SystemCapability.MiscServices.Pasteboard -| Name | Description | -| ----- | ----------------------- | -| InApp |Only intra-application pasting is allowed.| -| LocalDevice |Paste is allowed in any application on the local device.| -| CrossDevice |Paste is allowed in any application across devices.| +| Name| Value| Description | +| ---- |---|-------------------| +| InApp | 0 | Only intra-application pasting is allowed. | +| LocalDevice | 1 | Paste is allowed in any application on the local device.| +| CrossDevice | 2 | Paste is allowed in any application across devices. | ## pasteboard.createHtmlData(deprecated) @@ -418,7 +418,7 @@ Forcibly converts the content in a **PasteData** object to text. This API uses a **Example** ```js -let record = pasteboard.createUriRecord('dataability:///com.example.myapplication1/user.txt'); +let record = pasteboard.createRecord(pasteboard.MIMETYPE_TEXT_URI, 'dataability:///com.example.myapplication1/user.txt'); record.convertToTextV9((err, data) => { if (err) { console.error(`Failed to convert to text. Cause: ${err.message}`); @@ -445,7 +445,7 @@ Forcibly converts the content in a **PasteData** object to text. This API uses a **Example** ```js -let record = pasteboard.createUriRecord('dataability:///com.example.myapplication1/user.txt'); +let record = pasteboard.createRecord(pasteboard.MIMETYPE_TEXT_URI, 'dataability:///com.example.myapplication1/user.txt'); record.convertToTextV9().then((data) => { console.info(`Succeeded in converting to text. Data: ${data}`); }).catch((err) => { @@ -536,7 +536,7 @@ Obtains the plain text of the primary record. **Example** ```js -let pasteData = pasteboard.createPlainTextData('hello'); +let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, 'hello'); let plainText = pasteData.getPrimaryText(); ``` @@ -558,7 +558,7 @@ Obtains the HTML content of the primary record. ```js let html = "\n" + "\n" + "\n" + "\n" + "HTML-PASTEBOARD_HTML\n" + "\n" + "\n" + "

HEAD

\n" + "

\n" + "\n" + ""; -let pasteData = pasteboard.createHtmlData(html); +let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_HTML, html); let htmlText = pasteData.getPrimaryHtml(); ``` @@ -583,7 +583,7 @@ let object = { bundleName: "com.example.aafwk.test", abilityName: "com.example.aafwk.test.TwoAbility" }; -let pasteData = pasteboard.createWantData(object); +let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_WANT, object); let want = pasteData.getPrimaryWant(); ``` @@ -604,7 +604,7 @@ Obtains the URI of the primary record. **Example** ```js -let pasteData = pasteboard.createUriData('dataability:///com.example.myapplication1/user.txt'); +let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_URI, 'dataability:///com.example.myapplication1/user.txt'); let uri = pasteData.getPrimaryUri(); ``` @@ -636,7 +636,7 @@ let opt = { scaleMode: 1 }; image.createPixelMap(buffer, opt).then((pixelMap) => { - let pasteData = pasteboard.createData('app/xml',pixelMap); + let pasteData = pasteboard.createData(MIMETYPE_PIXELMAP, pixelMap); let PixelMap = pasteData.getPrimaryPixelMap(); }); ``` @@ -660,10 +660,10 @@ The pasteboard supports a maximum number of 512 data records. **Example** ```js -let pasteData = pasteboard.createUriData('dataability:///com.example.myapplication1/user.txt'); -let textRecord = pasteboard.createPlainTextRecord('hello'); +let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_URI, 'dataability:///com.example.myapplication1/user.txt'); +let textRecord = pasteboard.createRecord(pasteboard.MIMETYPE_TEXT_PLAIN, 'hello'); let html = "\n" + "\n" + "\n" + "\n" + "HTML-PASTEBOARD_HTML\n" + "\n" + "\n" + "

HEAD

\n" + "

\n" + "\n" + ""; -let htmlRecord = pasteboard.createHtmlTextRecord(html); +let htmlRecord = pasteboard.createRecord(pasteboard.MIMETYPE_TEXT_HTML, html); pasteData.addRecord(textRecord); pasteData.addRecord(htmlRecord); ``` @@ -695,7 +695,7 @@ For details about the error codes, see [Pasteboard Error Codes](../errorcodes/er **Example** ```js - let pasteData = pasteboard.createUriData('dataability:///com.example.myapplication1/user.txt'); + let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_URI, 'dataability:///com.example.myapplication1/user.txt'); let dataXml = new ArrayBuffer(256); pasteData.addRecord('app/xml', dataXml); ``` @@ -717,7 +717,7 @@ Obtains a list of **mimeTypes** objects in [PasteDataProperty](#pastedatapropert **Example** ```js -let pasteData = pasteboard.createPlainTextData('hello'); +let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, 'hello'); let types = pasteData.getMimeTypes(); ``` @@ -738,7 +738,7 @@ Obtains the data type of the primary record in this pasteboard. **Example** ```js -let pasteData = pasteboard.createPlainTextData('hello'); +let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, 'hello'); let type = pasteData.getPrimaryMimeType(); ``` @@ -759,7 +759,7 @@ Obtains the property of the pasteboard data. **Example** ```js -let pasteData = pasteboard.createPlainTextData('hello'); +let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, 'hello'); let property = pasteData.getProperty(); ``` @@ -780,7 +780,7 @@ Sets the property (attributes) for the pasteboard data. Currently, only the **sh **Example** ```js -let pasteData = pasteboard.createHtmlData('application/xml'); +let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_HTML, 'application/xml'); let prop = pasteData.getProperty(); prop.shareOption = pasteboard.ShareOption.InApp; pasteData.setProperty(prop); @@ -817,7 +817,7 @@ For details about the error codes, see [Pasteboard Error Codes](../errorcodes/er **Example** ```js -let pasteData = pasteboard.createPlainTextData('hello'); +let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, 'hello'); let record = pasteData.getRecord(0); ``` @@ -838,7 +838,7 @@ Obtains the number of records in the pasteboard. **Example** ```js -let pasteData = pasteboard.createPlainTextData('hello'); +let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, 'hello'); let count = pasteData.getRecordCount(); ``` @@ -859,7 +859,7 @@ Obtains the custom tag from the pasteboard. If no custom tag is set, null is ret **Example** ```js -let pasteData = pasteboard.createPlainTextData('hello'); +let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, 'hello'); let tag = pasteData.getTag(); ``` @@ -886,7 +886,7 @@ Checks whether the pasteboard contains data of the specified type. **Example** ```js -let pasteData = pasteboard.createPlainTextData('hello'); +let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, 'hello'); let hasType = pasteData.hasType(pasteboard.MIMETYPE_TEXT_PLAIN); ``` @@ -915,7 +915,7 @@ For details about the error codes, see [Pasteboard Error Codes](../errorcodes/er **Example** ```js -let pasteData = pasteboard.createPlainTextData('hello'); +let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, 'hello'); pasteData.removeRecord(0); ``` @@ -945,8 +945,8 @@ For details about the error codes, see [Pasteboard Error Codes](../errorcodes/er **Example** ```js -let pasteData = pasteboard.createPlainTextData('hello'); -let record = pasteboard.createUriRecord('dataability:///com.example.myapplication1/user.txt'); +let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, 'hello'); +let record = pasteboard.createRecord(pasteboard.MIMETYPE_TEXT_URI, 'dataability:///com.example.myapplication1/user.txt'); pasteData.replaceRecord(0, record); ``` ### addHtmlRecord(deprecated) diff --git a/en/application-dev/reference/apis/js-apis-prompt.md b/en/application-dev/reference/apis/js-apis-prompt.md index 27a450de58..a7ba5ea9bd 100644 --- a/en/application-dev/reference/apis/js-apis-prompt.md +++ b/en/application-dev/reference/apis/js-apis-prompt.md @@ -1,4 +1,4 @@ -# @ohos.prompt +# @ohos.prompt (Prompt) The **Prompt** module provides APIs for creating and showing toasts, dialog boxes, and action menus. diff --git a/en/application-dev/reference/apis/js-apis-promptAction.md b/en/application-dev/reference/apis/js-apis-promptAction.md index 0faa9cf211..2d01a8db31 100644 --- a/en/application-dev/reference/apis/js-apis-promptAction.md +++ b/en/application-dev/reference/apis/js-apis-promptAction.md @@ -1,4 +1,4 @@ -# @ohos.promptAction +# @ohos.promptAction (Prompt) The **PromptAction** module provides APIs for creating and showing toasts, dialog boxes, and action menus. diff --git a/en/application-dev/reference/apis/js-apis-router.md b/en/application-dev/reference/apis/js-apis-router.md index 11bb575b30..80451d894a 100644 --- a/en/application-dev/reference/apis/js-apis-router.md +++ b/en/application-dev/reference/apis/js-apis-router.md @@ -1,4 +1,4 @@ -# @ohos.router +# @ohos.router (Page Routing) The **Router** module provides APIs to access pages through URLs. You can use the APIs to navigate to a specified page in an application, replace the current page with another one in an application, and return to the previous page or a specified page. diff --git a/en/application-dev/reference/apis/js-apis-settings.md b/en/application-dev/reference/apis/js-apis-settings.md index 5972e0cd9a..9b846b7edd 100644 --- a/en/application-dev/reference/apis/js-apis-settings.md +++ b/en/application-dev/reference/apis/js-apis-settings.md @@ -1,4 +1,4 @@ -# @ohos.settings +# @ohos.settings (Data Item Settings) The **settings** module provides APIs for setting data items. diff --git a/en/application-dev/reference/apis/js-apis-system-date-time.md b/en/application-dev/reference/apis/js-apis-system-date-time.md index 90c915b32e..b7ea33fa58 100644 --- a/en/application-dev/reference/apis/js-apis-system-date-time.md +++ b/en/application-dev/reference/apis/js-apis-system-date-time.md @@ -1,4 +1,4 @@ -# @ohos.systemDateTime +# @ohos.systemDateTime (System Time and Time Zone) The **systemDateTime** module provides system time and time zone features. You can use the APIs of this module to set and obtain the system time and time zone. @@ -35,15 +35,15 @@ Sets the system time. This API uses an asynchronous callback to return the resul // Set the system time to 2021-01-20 02:36:25. let time = 1611081385000; try { - systemDateTime.setTime(time, (error) => { - if (error) { - console.info(`Failed to set time. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in setting time`); - }); + systemDateTime.setTime(time, (error) => { + if (error) { + console.info(`Failed to set time. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in setting time`); + }); } catch(e) { - console.info(`Failed to set time. message:${e.message}, code:${e.code}`); + console.info(`Failed to set time. message: ${e.message}, code: ${e.code}`); } ``` @@ -75,13 +75,13 @@ Sets the system time. This API uses a promise to return the result. // Set the system time to 2021-01-20 02:36:25. let time = 1611081385000; try { - systemDateTime.setTime(time).then(() => { - console.info(`Succeeded in setting time.`); - }).catch((error) => { - console.info(`Failed to set time. message:${error.message}, code:${error.code}`); - }); + systemDateTime.setTime(time).then(() => { + console.info(`Succeeded in setting time.`); + }).catch((error) => { + console.info(`Failed to set time. message: ${error.message}, code: ${error.code}`); + }); } catch(e) { - console.info(`Failed to set time. message:${e.message}, code:${e.code}`); + console.info(`Failed to set time. message: ${e.message}, code: ${e.code}`); } ``` @@ -104,15 +104,15 @@ Obtains the time elapsed since the Unix epoch. This API uses an asynchronous cal ```js try { - systemDateTime.getCurrentTime(true, (error, time) => { - if (error) { - console.info(`Failed to get currentTime. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in getting currentTime : ${time}`); - }); + systemDateTime.getCurrentTime(true, (error, time) => { + if (error) { + console.info(`Failed to get currentTime. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in getting currentTime : ${time}`); + }); } catch(e) { - console.info(`Failed to get currentTime. message:${e.message}, code:${e.code}`); + console.info(`Failed to get currentTime. message: ${e.message}, code: ${e.code}`); } ``` @@ -134,15 +134,15 @@ Obtains the time elapsed since the Unix epoch. This API uses an asynchronous cal ```js try { - systemDateTime.getCurrentTime((error, time) => { - if (error) { - console.info(`Failed to get currentTime. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in getting currentTime : ${time}`); - }); + systemDateTime.getCurrentTime((error, time) => { + if (error) { + console.info(`Failed to get currentTime. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in getting currentTime : ${time}`); + }); } catch(e) { - console.info(`Failed to get currentTime. message:${e.message}, code:${e.code}`); + console.info(`Failed to get currentTime. message: ${e.message}, code: ${e.code}`); } ``` @@ -170,13 +170,13 @@ Obtains the time elapsed since the Unix epoch. This API uses a promise to return ```js try { - systemDateTime.getCurrentTime().then((time) => { - console.info(`Succeeded in getting currentTime : ${time}`); - }).catch((error) => { - console.info(`Failed to get currentTime. message:${error.message}, code:${error.code}`); - }); + systemDateTime.getCurrentTime().then((time) => { + console.info(`Succeeded in getting currentTime : ${time}`); + }).catch((error) => { + console.info(`Failed to get currentTime. message: ${error.message}, code: ${error.code}`); + }); } catch(e) { - console.info(`Failed to get currentTime. message:${e.message}, code:${e.code}`); + console.info(`Failed to get currentTime. message: ${e.message}, code: ${e.code}`); } ``` @@ -199,15 +199,15 @@ Obtains the time elapsed since system startup, excluding the deep sleep time. Th ```js try { - systemDateTime.getRealActiveTime(true, (error, time) => { - if (error) { - console.info(`Failed to get real active time. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in getting real active time : ${time}`); - }); + systemDateTime.getRealActiveTime(true, (error, time) => { + if (error) { + console.info(`Failed to get real active time. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in getting real active time : ${time}`); + }); } catch(e) { - console.info(`Failed to get real active time. message:${e.message}, code:${e.code}`); + console.info(`Failed to get real active time. message: ${e.message}, code: ${e.code}`); } ``` @@ -229,15 +229,15 @@ Obtains the time elapsed since system startup, excluding the deep sleep time. Th ```js try { - systemDateTime.getRealActiveTime((error, time) => { - if (error) { - console.info(`Failed to get real active time. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in getting real active time : ${time}`); - }); + systemDateTime.getRealActiveTime((error, time) => { + if (error) { + console.info(`Failed to get real active time. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in getting real active time : ${time}`); + }); } catch(e) { - console.info(`Failed to get real active time. message:${e.message}, code:${e.code}`); + console.info(`Failed to get real active time. message: ${e.message}, code: ${e.code}`); } ``` @@ -265,13 +265,13 @@ Obtains the time elapsed since system startup, excluding the deep sleep time. Th ```js try { - systemDateTime.getRealActiveTime().then((time) => { - console.info(`Succeeded in getting real active time : ${time}`); - }).catch((error) => { - console.info(`Failed to get real active time. message:${error.message}, code:${error.code}`); - }); + systemDateTime.getRealActiveTime().then((time) => { + console.info(`Succeeded in getting real active time : ${time}`); + }).catch((error) => { + console.info(`Failed to get real active time. message: ${error.message}, code: ${error.code}`); + }); } catch(e) { - console.info(`Failed to get real active time. message:${e.message}, code:${e.code}`); + console.info(`Failed to get real active time. message: ${e.message}, code: ${e.code}`); } ``` @@ -294,15 +294,15 @@ Obtains the time elapsed since system startup, including the deep sleep time. Th ```js try { - systemDateTime.getRealTime(true, (error, time) => { - if (error) { - console.info(`Failed to get real time. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in getting real time : ${time}`); - }); + systemDateTime.getRealTime(true, (error, time) => { + if (error) { + console.info(`Failed to get real time. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in getting real time : ${time}`); + }); } catch(e) { - console.info(`Failed to get real time. message:${e.message}, code:${e.code}`); + console.info(`Failed to get real time. message: ${e.message}, code: ${e.code}`); } ``` @@ -324,15 +324,15 @@ Obtains the time elapsed since system startup, including the deep sleep time. Th ```js try { - systemDateTime.getRealTime((error, time) => { - if (error) { - console.info(`Failed to get real time. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in getting real time : ${time}`); - }); + systemDateTime.getRealTime((error, time) => { + if (error) { + console.info(`Failed to get real time. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in getting real time : ${time}`); + }); } catch(e) { - console.info(`Failed to get real time. message:${e.message}, code:${e.code}`); + console.info(`Failed to get real time. message: ${e.message}, code: ${e.code}`); } ``` @@ -360,13 +360,13 @@ Obtains the time elapsed since system startup, including the deep sleep time. Th ```js try { - systemDateTime.getRealTime().then((time) => { - console.info(`Succeeded in getting real time : ${time}`); - }).catch((error) => { - console.info(`Failed to get real time. message:${error.message}, code:${error.code}`); - }); + systemDateTime.getRealTime().then((time) => { + console.info(`Succeeded in getting real time : ${time}`); + }).catch((error) => { + console.info(`Failed to get real time. message: ${error.message}, code: ${error.code}`); + }); } catch(e) { - console.info(`Failed to get real time. message:${e.message}, code:${e.code}`); + console.info(`Failed to get real time. message: ${e.message}, code: ${e.code}`); } ``` @@ -392,15 +392,15 @@ Sets the system date. This API uses an asynchronous callback to return the resul ```js let date = new Date(); try { - systemDateTime.setDate(date, (error) => { - if (error) { - console.info(`Failed to set date. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in setting date.`); - }); + systemDateTime.setDate(date, (error) => { + if (error) { + console.info(`Failed to set date. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in setting date.`); + }); } catch(e) { - console.info(`Failed to set date. message:${e.message}, code:${e.code}`); + console.info(`Failed to set date. message: ${e.message}, code: ${e.code}`); } ``` @@ -431,13 +431,13 @@ Sets the system date. This API uses a promise to return the result. ```js let date = new Date(); try { - systemDateTime.setDate(date).then(() => { - console.info(`Succeeded in setting date.`); - }).catch((error) => { - console.info(`Failed to set date. message:${error.message}, code:${error.code}`); - }); + systemDateTime.setDate(date).then(() => { + console.info(`Succeeded in setting date.`); + }).catch((error) => { + console.info(`Failed to set date. message: ${error.message}, code: ${error.code}`); + }); } catch(e) { - console.info(`Failed to set date. message:${e.message}, code:${e.code}`); + console.info(`Failed to set date. message: ${e.message}, code: ${e.code}`); } ``` @@ -459,15 +459,15 @@ Obtains the current system date. This API uses an asynchronous callback to retur ```js try { - systemDateTime.getDate((error, date) => { - if (error) { - console.info(`Failed to get date. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in getting date : ${date}`);; - }); + systemDateTime.getDate((error, date) => { + if (error) { + console.info(`Failed to get date. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in getting date : ${date}`);; + }); } catch(e) { - console.info(`Failed to get date. message:${e.message}, code:${e.code}`); + console.info(`Failed to get date. message: ${e.message}, code: ${e.code}`); } ``` @@ -489,13 +489,13 @@ Obtains the current system date. This API uses a promise to return the result. ```js try { - systemDateTime.getDate().then((date) => { - console.info(`Succeeded in getting date : ${date}`); - }).catch((error) => { - console.info(`Failed to get date. message:${error.message}, code:${error.code}`); - }); + systemDateTime.getDate().then((date) => { + console.info(`Succeeded in getting date : ${date}`); + }).catch((error) => { + console.info(`Failed to get date. message: ${error.message}, code: ${error.code}`); + }); } catch(e) { - console.info(`Failed to get date. message:${e.message}, code:${e.code}`); + console.info(`Failed to get date. message: ${e.message}, code: ${e.code}`); } ``` @@ -520,15 +520,15 @@ Sets the system time zone. This API uses an asynchronous callback to return the ```js try { - systemDateTime.setTimezone('Asia/Shanghai', (error) => { - if (error) { - console.info(`Failed to set timezone. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in setting timezone.`); - }); + systemDateTime.setTimezone('Asia/Shanghai', (error) => { + if (error) { + console.info(`Failed to set timezone. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in setting timezone.`); + }); } catch(e) { - console.info(`Failed to set timezone. message:${e.message}, code:${e.code}`); + console.info(`Failed to set timezone. message: ${e.message}, code: ${e.code}`); } ``` @@ -558,13 +558,13 @@ Sets the system time zone. This API uses a promise to return the result. ```js try { - systemDateTime.setTimezone('Asia/Shanghai').then(() => { - console.info(`Succeeded in setting timezone.`); - }).catch((error) => { - console.info(`Failed to set timezone. message:${error.message}, code:${error.code}`); - }); + systemDateTime.setTimezone('Asia/Shanghai').then(() => { + console.info(`Succeeded in setting timezone.`); + }).catch((error) => { + console.info(`Failed to set timezone. message: ${error.message}, code: ${error.code}`); + }); } catch(e) { - console.info(`Failed to set timezone. message:${e.message}, code:${e.code}`); + console.info(`Failed to set timezone. message: ${e.message}, code: ${e.code}`); } ``` @@ -586,15 +586,15 @@ Obtains the system time zone. This API uses an asynchronous callback to return t ```js try { - systemDateTime.getTimezone((error, data) => { - if (error) { - console.info(`Failed to get timezone. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in get timezone : ${data}`);; - }); + systemDateTime.getTimezone((error, data) => { + if (error) { + console.info(`Failed to get timezone. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in get timezone : ${data}`);; + }); } catch(e) { - console.info(`Failed to get timezone. message:${e.message}, code:${e.code}`); + console.info(`Failed to get timezone. message: ${e.message}, code: ${e.code}`); } ``` @@ -616,13 +616,13 @@ Obtains the system time zone. This API uses a promise to return the result. ```js try { - systemDateTime.getTimezone().then((data) => { - console.info(`Succeeded in getting timezone: ${data}`); - }).catch((error) => { - console.info(`Failed to get timezone. message:${error.message}, code:${error.code}`); - }); + systemDateTime.getTimezone().then((data) => { + console.info(`Succeeded in getting timezone: ${data}`); + }).catch((error) => { + console.info(`Failed to get timezone. message: ${error.message}, code: ${error.code}`); + }); } catch(e) { - console.info(`Failed to get timezone. message:${e.message}, code:${e.code}`); + console.info(`Failed to get timezone. message: ${e.message}, code: ${e.code}`); } ``` diff --git a/en/application-dev/reference/apis/js-apis-system-device.md b/en/application-dev/reference/apis/js-apis-system-device.md index 6da9ae481f..bb56a0899e 100644 --- a/en/application-dev/reference/apis/js-apis-system-device.md +++ b/en/application-dev/reference/apis/js-apis-system-device.md @@ -1,4 +1,4 @@ -# @system.device +# @system.device (Device Information) The **device** module provides APIs for checking information about the current device. diff --git a/en/application-dev/reference/apis/js-apis-system-mediaquery.md b/en/application-dev/reference/apis/js-apis-system-mediaquery.md index 841cebeb1d..bc415bc337 100644 --- a/en/application-dev/reference/apis/js-apis-system-mediaquery.md +++ b/en/application-dev/reference/apis/js-apis-system-mediaquery.md @@ -1,4 +1,4 @@ -# Media Query +# @system.mediaquery (Media Query) The **mediaquery** module provides different styles for different media types. @@ -12,7 +12,7 @@ The **mediaquery** module provides different styles for different media types. ## Modules to Import -``` +```ts import mediaquery from '@system.mediaquery'; ``` @@ -39,8 +39,8 @@ Creates a **MediaQueryList** object based on the query condition. **Example** -``` -var mMediaQueryList = mediaquery.matchMedia('(max-width: 466)'); +```ts +let mMediaQueryList = mediaquery.matchMedia('(max-width: 466)'); ``` ## MediaQueryEvent @@ -97,7 +97,7 @@ Adds a listener for this **MediaQueryList** object. The listener must be added b **Example** -``` +```ts function maxWidthMatch(e){ if(e.matches){ // do something @@ -123,7 +123,7 @@ Removes the listener for this **MediaQueryList** object. **Example** -``` +```ts function maxWidthMatch(e){ if(e.matches){ // do something diff --git a/en/application-dev/reference/apis/js-apis-system-parameter.md b/en/application-dev/reference/apis/js-apis-system-parameter.md index ab3ae31887..db74b6b6c4 100644 --- a/en/application-dev/reference/apis/js-apis-system-parameter.md +++ b/en/application-dev/reference/apis/js-apis-system-parameter.md @@ -1,4 +1,4 @@ -# @ohos.systemParameter +# @ohos.systemParameter (System Parameter) The **SystemParameter** module provides system services with easy access to key-value pairs. You can use the APIs provided by this module to describe the service status and change the service behavior. The basic operation primitives are get and set. You can obtain the values of system parameters through getters and modify the values through setters. For details about the system parameter design principles and definitions, see diff --git a/en/application-dev/reference/apis/js-apis-system-parameterV9.md b/en/application-dev/reference/apis/js-apis-system-parameterV9.md index 23ad27a045..97e9b165f3 100644 --- a/en/application-dev/reference/apis/js-apis-system-parameterV9.md +++ b/en/application-dev/reference/apis/js-apis-system-parameterV9.md @@ -1,4 +1,4 @@ -# SystemParameter +# SystemParameter (System Parameter) The **SystemParameter** module provides system services with easy access to key-value pairs. You can use the APIs provided by this module to describe the service status and change the service behavior. The basic operation primitives are get and set. You can obtain the values of system parameters through getters and modify the values through setters. For details about the system parameter design principles and definitions, see diff --git a/en/application-dev/reference/apis/js-apis-system-prompt.md b/en/application-dev/reference/apis/js-apis-system-prompt.md index e37601dbfa..5f33952a9d 100644 --- a/en/application-dev/reference/apis/js-apis-system-prompt.md +++ b/en/application-dev/reference/apis/js-apis-system-prompt.md @@ -1,4 +1,6 @@ -# Prompt +# @system.prompt (Prompt) + +The **PromptAction** module provides APIs for creating and showing toasts, dialog boxes, and action menus. > **NOTE** > diff --git a/en/application-dev/reference/apis/js-apis-system-router.md b/en/application-dev/reference/apis/js-apis-system-router.md index 1d47c8883a..6e45d6c012 100644 --- a/en/application-dev/reference/apis/js-apis-system-router.md +++ b/en/application-dev/reference/apis/js-apis-system-router.md @@ -1,4 +1,4 @@ -# @system.router +# @system.router (Page Routing) The **Router** module provides APIs to access pages through URIs. diff --git a/en/application-dev/reference/apis/js-apis-system-timer.md b/en/application-dev/reference/apis/js-apis-system-timer.md index fb1f95ce2d..cc15e7f85a 100644 --- a/en/application-dev/reference/apis/js-apis-system-timer.md +++ b/en/application-dev/reference/apis/js-apis-system-timer.md @@ -1,4 +1,4 @@ -# @ohos.systemTimer +# @ohos.systemTimer (System Timer) The **systemTimer** module provides system timer features. You can use the APIs of this module to implement the alarm clock and other timer services. @@ -63,23 +63,23 @@ Creates a timer. This API uses an asynchronous callback to return the result. ```js export default { - systemTimer () { - let options = { - type: systemTimer.TIMER_TYPE_REALTIME, - repeat: false - }; - try { - systemTimer.createTimer(options, (error) => { - if (error) { - console.info(`Failed to create timer. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in creating timer.`); - }); - } catch(e) { - console.info(`Failed to create timer. message:${e.message}, code:${e.code}`); + systemTimer () { + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat: false + }; + try { + systemTimer.createTimer(options, (error, timerId) => { + if (error) { + console.info(`Failed to create timer. message: ${error.message}, code: ${error.code}`); + return; } + console.info(`Succeeded in creating timer. timerId: ${timerId}`); + }); + } catch(e) { + console.info(`Failed to create timer. message: ${e.message}, code: ${e.code}`); } + } } ``` @@ -109,21 +109,21 @@ Creates a timer. This API uses a promise to return the result. ```js export default { - systemTimer () { - let options = { - type: systemTimer.TIMER_TYPE_REALTIME, - repeat:false - }; - try { - systemTimer.createTimer(options).then(() => { - console.info(`Succeeded in creating timer.`); - }).catch((error) => { - console.info(`Failed to create timer. message:${error.message}, code:${error.code}`); - }); - } catch(e) { - console.info(`Failed to create timer. message:${e.message}, code:${e.code}`); - } + systemTimer () { + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + }; + try { + systemTimer.createTimer(options).then((timerId) => { + console.info(`Succeeded in creating timer. timerId: ${timerId}`); + }).catch((error) => { + console.info(`Failed to create timer. message: ${error.message}, code: ${error.code}`); + }); + } catch(e) { + console.info(`Failed to create timer. message: ${e.message}, code: ${e.code}`); } + } } ``` @@ -149,26 +149,26 @@ Starts a timer. This API uses an asynchronous callback to return the result. ```js export default { - async systemTimer () { - let options = { - type: systemTimer.TIMER_TYPE_REALTIME, - repeat:false + async systemTimer () { + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + try { + systemTimer.startTimer(timerId, triggerTime, (error) => { + if (error) { + console.info(`Failed to start timer. message: ${error.message}, code: ${error.code}`); + return; } - let timerId = await systemTimer.createTimer(options) - let triggerTime = new Date().getTime() - triggerTime += 3000 - try { - systemTimer.startTimer(timerId, triggerTime, (error) => { - if (error) { - console.info(`Failed to start timer. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in starting timer.`); - }); - } catch(e) { - console.info(`Failed to start timer. message:${e.message}, code:${e.code}`); - } + console.info(`Succeeded in starting timer.`); + }); + } catch(e) { + console.info(`Failed to start timer. message: ${e.message}, code: ${e.code}`); } + } } ``` @@ -199,24 +199,24 @@ Starts a timer. This API uses a promise to return the result. ```js export default { - async systemTimer (){ - let options = { - type: systemTimer.TIMER_TYPE_REALTIME, - repeat:false - } - let timerId = await systemTimer.createTimer(options) - let triggerTime = new Date().getTime() - triggerTime += 3000 - try { - systemTimer.startTimer(timerId, triggerTime).then(() => { - console.info(`Succeeded in starting timer.`); - }).catch((error) => { - console.info(`Failed to start timer. message:${error.message}, code:${error.code}`); - }); - } catch(e) { - console.info(`Failed to start timer. message:${e.message}, code:${e.code}`); - } + async systemTimer (){ + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + try { + systemTimer.startTimer(timerId, triggerTime).then(() => { + console.info(`Succeeded in starting timer.`); + }).catch((error) => { + console.info(`Failed to start timer. message: ${error.message}, code: ${error.code}`); + }); + } catch(e) { + console.info(`Failed to start timer. message: ${e.message}, code: ${e.code}`); + } + } } ``` @@ -241,27 +241,27 @@ Stops a timer. This API uses an asynchronous callback to return the result. ```js export default { - async systemTimer () { - let options = { - type: systemTimer.TIMER_TYPE_REALTIME, - repeat:false - } - let timerId = await systemTimer.createTimer(options) - let triggerTime = new Date().getTime() - triggerTime += 3000 - systemTimer.startTimer(timerId, triggerTime) - try { - systemTimer.stopTimer(timerId, (error) => { - if (error) { - console.info(`Failed to stop timer. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in stopping timer.`); - }); - } catch(e) { - console.info(`Failed to stop timer. message:${e.message}, code:${e.code}`); + async systemTimer () { + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + systemTimer.startTimer(timerId, triggerTime); + try { + systemTimer.stopTimer(timerId, (error) => { + if (error) { + console.info(`Failed to stop timer. message: ${error.message}, code: ${error.code}`); + return; } - } + console.info(`Succeeded in stopping timer.`); + }); + } catch(e) { + console.info(`Failed to stop timer. message: ${e.message}, code: ${e.code}`); + } + } } ``` @@ -291,25 +291,25 @@ Stops a timer. This API uses a promise to return the result. ```js export default { - async systemTimer (){ - let options = { - type: systemTimer.TIMER_TYPE_REALTIME, - repeat:false - } - let timerId = await systemTimer.createTimer(options) - let triggerTime = new Date().getTime() - triggerTime += 3000 - systemTimer.startTimer(timerId, triggerTime) - try { - systemTimer.stopTimer(timerId).then(() => { - console.info(`Succeeded in stopping timer.`); - }).catch((error) => { - console.info(`Failed to stop timer. message:${error.message}, code:${error.code}`); - }); - } catch(e) { - console.info(`Failed to stop timer. message:${e.message}, code:${e.code}`); - } + async systemTimer (){ + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + systemTimer.startTimer(timerId, triggerTime); + try { + systemTimer.stopTimer(timerId).then(() => { + console.info(`Succeeded in stopping timer.`); + }).catch((error) => { + console.info(`Failed to stop timer. message: ${error.message}, code: ${error.code}`); + }); + } catch(e) { + console.info(`Failed to stop timer. message: ${e.message}, code: ${e.code}`); } + } } ``` @@ -334,28 +334,28 @@ Destroys a timer. This API uses an asynchronous callback to return the result. ```js export default { - async systemTimer () { - let options = { - type: systemTimer.TIMER_TYPE_REALTIME, - repeat:false - } - let timerId = await systemTimer.createTimer(options) - let triggerTime = new Date().getTime() - triggerTime += 3000 - systemTimer.startTimer(timerId, triggerTime) - systemTimer.stopTimer(timerId) - try { - systemTimer.destroyTimer(timerId, (error) => { - if (error) { - console.info(`Failed to destroy timer. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in destroying timer.`); - }); - } catch(e) { - console.info(`Failed to destroying timer. message:${e.message}, code:${e.code}`); + async systemTimer () { + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + systemTimer.startTimer(timerId, triggerTime); + systemTimer.stopTimer(timerId); + try { + systemTimer.destroyTimer(timerId, (error) => { + if (error) { + console.info(`Failed to destroy timer. message: ${error.message}, code: ${error.code}`); + return; } + console.info(`Succeeded in destroying timer.`); + }); + } catch(e) { + console.info(`Failed to destroying timer. message: ${e.message}, code: ${e.code}`); } + } } ``` @@ -385,25 +385,25 @@ Destroys a timer. This API uses a promise to return the result. ```js export default { - async systemTimer (){ - let options = { - type: systemTimer.TIMER_TYPE_REALTIME, - repeat:false - } - let timerId = await systemTimer.createTimer(options) - let triggerTime = new Date().getTime() - triggerTime += 3000 - systemTimer.startTimer(timerId, triggerTime) - systemTimer.stopTimer(timerId) - try { - systemTimer.destroyTimer(timerId).then(() => { - console.info(`Succeeded in destroying timer.`); - }).catch((error) => { - console.info(`Failed to destroy timer. message:${error.message}, code:${error.code}`); - }); - } catch(e) { - console.info(`Failed to destroying timer. message:${e.message}, code:${e.code}`); - } + async systemTimer (){ + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + systemTimer.startTimer(timerId, triggerTime); + systemTimer.stopTimer(timerId); + try { + systemTimer.destroyTimer(timerId).then(() => { + console.info(`Succeeded in destroying timer.`); + }).catch((error) => { + console.info(`Failed to destroy timer. message: ${error.message}, code: ${error.code}`); + }); + } catch(e) { + console.info(`Failed to destroying timer. message: ${e.message}, code: ${e.code}`); } + } } ``` diff --git a/en/application-dev/reference/apis/js-apis-uitest.md b/en/application-dev/reference/apis/js-apis-uitest.md index d4b84b0d93..8c229cc5ec 100644 --- a/en/application-dev/reference/apis/js-apis-uitest.md +++ b/en/application-dev/reference/apis/js-apis-uitest.md @@ -1,4 +1,4 @@ -# @ohos.uitest +# @ohos.uitest (UiTest) The **UiTest** module provides APIs that you can use to simulate UI actions during testing, such as clicks, double-clicks, long-clicks, and swipes. diff --git a/en/application-dev/reference/apis/js-apis-wallpaper.md b/en/application-dev/reference/apis/js-apis-wallpaper.md index c7f4c94d54..e8d51f5b1c 100644 --- a/en/application-dev/reference/apis/js-apis-wallpaper.md +++ b/en/application-dev/reference/apis/js-apis-wallpaper.md @@ -1,4 +1,4 @@ -# @ohos.wallpaper +# @ohos.wallpaper (Wallpaper) The **wallpaper** module is a system service module in OpenHarmony that provides the wallpaper management service. You can use the APIs of this module to show, set, and switch between wallpapers. diff --git a/en/application-dev/reference/apis/js-apis-webview.md b/en/application-dev/reference/apis/js-apis-webview.md index 83d89392cd..4a7bee42b6 100644 --- a/en/application-dev/reference/apis/js-apis-webview.md +++ b/en/application-dev/reference/apis/js-apis-webview.md @@ -1,6 +1,4 @@ - - -# @ohos.web.webview +# @ohos.web.webview (Webview) The **Webview** module provides APIs for web control. -- GitLab