diff --git a/en/application-dev/reference/apis/js-apis-i18n.md b/en/application-dev/reference/apis/js-apis-i18n.md index 9baa14b8fcc490c92a115d026628c9f4a5613436..a21e4ddb660cba43fef79e5e509464eca986aea9 100644 --- a/en/application-dev/reference/apis/js-apis-i18n.md +++ b/en/application-dev/reference/apis/js-apis-i18n.md @@ -35,7 +35,7 @@ Obtains the localized script for the specified language. | string | Localized script for the specified language.| **Example** - ``` + ```js i18n.getDisplayLanguage("zh", "en-GB", true); i18n.getDisplayLanguage("zh", "en-GB"); ``` @@ -62,7 +62,7 @@ Obtains the localized script for the specified country. | string | Localized script for the specified country.| **Example** - ``` + ```js i18n.getDisplayCountry("zh-CN", "en-GB", true); i18n.getDisplayCountry("zh-CN", "en-GB"); ``` @@ -87,7 +87,7 @@ Checks whether the localized script for the specified language is displayed from | boolean | Returns **true** if the localized script is displayed from right to left; returns **false** otherwise.| **Example** - ``` + ```js i18n.isRTL("zh-CN");// Since Chinese is not written from right to left, false is returned. i18n.isRTL("ar-EG");// Since Arabic is written from right to left, true is returned. ``` @@ -107,7 +107,7 @@ Obtains the system language. | string | System language ID.| **Example** - ``` + ```js i18n.getSystemLanguage(); ``` @@ -135,7 +135,7 @@ This is a system API. | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** - ``` + ```js i18n.setSystemLanguage('zh'); ``` @@ -156,7 +156,7 @@ Obtains the list of system languages. | Array<string> | List of the IDs of system languages.| **Example** - ``` + ```js i18n.getSystemLanguages(); ``` @@ -182,7 +182,7 @@ Obtains the list of countries and regions supported for the specified language. | Array<string> | List of the IDs of the countries and regions supported for the specified language.| **Example** - ``` + ```js i18n.getSystemCountries('zh'); ``` @@ -201,7 +201,7 @@ Obtains the system region. | string | System region ID.| **Example** - ``` + ```js i18n.getSystemRegion(); ``` @@ -229,7 +229,7 @@ This is a system API. | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** - ``` + ```js i18n.setSystemRegion('CN'); ``` @@ -248,7 +248,7 @@ Obtains the system locale. | string | System locale ID.| **Example** - ``` + ```js i18n.getSystemLocale(); ``` @@ -276,7 +276,7 @@ This is a system API. | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** - ``` + ```js i18n.setSystemLocale('zh-CN'); ``` @@ -303,7 +303,7 @@ Checks whether the system language matches the specified region. | boolean | Returns **true** if the system language matches the specified region; returns **false** otherwise.| **Example** - ``` + ```js i18n.isSuggested('zh', 'CN'); ``` @@ -328,7 +328,7 @@ Obtains a **Calendar** object. | [Calendar](#calendar8) | **Calendar** object.| **Example** - ``` + ```js i18n.getCalendar("zh-Hans", "gregory"); ``` @@ -350,7 +350,7 @@ Sets the date for this **Calendar** object. | date | Date | Yes | Date to be set for the **Calendar** object.| **Example** - ``` + ```js var calendar = i18n.getCalendar("en-US", "gregory"); var date = new Date(2021, 10, 7, 8, 0, 0, 0); calendar.setTime(date); @@ -371,7 +371,7 @@ Sets the date and time for this **Calendar** object. The value is represented by | time | number | Yes | Number of milliseconds that have elapsed since the Unix epoch.| **Example** - ``` + ```js var calendar = i18n.getCalendar("en-US", "gregory"); calendar.setTime(10540800000); ``` @@ -396,7 +396,7 @@ Sets the year, month, day, hour, minute, and second for this **Calendar** object | second | number | No | Second to set. | **Example** - ``` + ```js var calendar = i18n.getCalendar("zh-Hans"); calendar.set(2021, 10, 1, 8, 0, 0); // set time to 2021.10.1 08:00:00 ``` @@ -416,7 +416,7 @@ Sets the time zone of this **Calendar** object. | timezone | string | Yes | Time zone, for example, **Asia/Shanghai**.| **Example** - ``` + ```js var calendar = i18n.getCalendar("zh-Hans"); calendar.setTimeZone("Asia/Shanghai"); ``` @@ -436,7 +436,7 @@ Obtains the time zone of this **Calendar** object. | string | Time zone of the **Calendar** object.| **Example** - ``` + ```js var calendar = i18n.getCalendar("zh-Hans"); calendar.setTimeZone("Asia/Shanghai"); calendar.getTimeZone(); // Asia/Shanghai" @@ -457,7 +457,7 @@ Obtains the start day of a week for this **Calendar** object. | number | Start day of a week. The value **1** indicates Sunday, and the value **7** indicates Saturday.| **Example** - ``` + ```js var calendar = i18n.getCalendar("en-US", "gregory"); calendar.getFirstDayOfWeek(); ``` @@ -477,7 +477,7 @@ Sets the start day of a week for this **Calendar** object. | value | number | No | Start day of a week. The value **1** indicates Sunday, and the value **7** indicates Saturday.| **Example** - ``` + ```js var calendar = i18n.getCalendar("zh-Hans"); calendar.setFirstDayOfWeek(0); ``` @@ -497,7 +497,7 @@ Obtains the minimum number of days in the first week of a year. | number | Minimum number of days in the first week of a year.| **Example** - ``` + ```js var calendar = i18n.getCalendar("zh-Hans"); calendar.getMinimalDaysInFirstWeek(); ``` @@ -517,7 +517,7 @@ Sets the minimum number of days in the first week of a year. | value | number | No | Minimum number of days in the first week of a year.| **Example** - ``` + ```js var calendar = i18n.getCalendar("zh-Hans"); calendar.setMinimalDaysInFirstWeek(3); ``` @@ -542,7 +542,7 @@ Obtains the value of the specified field in the **Calendar** object. | number | Value of the specified field. For example, if the year in the internal date of this **Calendar** object is **1990**, the **get("year")** function will return **1990**.| **Example** - ``` + ```js var calendar = i18n.getCalendar("zh-Hans"); calendar.set(2021, 10, 1, 8, 0, 0); // set time to 2021.10.1 08:00:00 calendar.get("hour_of_day"); // 8 @@ -568,7 +568,7 @@ Obtains the name of the **Calendar** object displayed for the specified locale. | string | Name of the **Calendar** object displayed for the specified locale.| **Example** - ``` + ```js var calendar = i18n.getCalendar("en-US", "buddhist"); calendar.getDisplayName("zh"); // Obtain the name of the Buddhist calendar in zh. ``` @@ -593,7 +593,7 @@ Checks whether the specified date in this **Calendar** object is a weekend. | boolean | Returns **true** if the date is a weekend; returns **false** if the date is a weekday.| **Example** - ``` + ```js var calendar = i18n.getCalendar("zh-Hans"); calendar.set(2021, 11, 11, 8, 0, 0); // set time to 2021.11.11 08:00:00 calendar.isWeekend(); // false @@ -620,7 +620,7 @@ Parameters | options | [PhoneNumberFormatOptions](#phonenumberformatoptions8) | No | Options of the **PhoneNumberFormat** object. | **Example** - ``` + ```js var phoneNumberFormat= new i18n.PhoneNumberFormat("CN", {"type": "E164"}); ``` @@ -644,7 +644,7 @@ Checks whether the format of the specified phone number is valid. | boolean | Returns **true** if the phone number format is valid; returns **false** otherwise.| **Example** - ``` + ```js var phonenumberfmt = new i18n.PhoneNumberFormat("CN"); phonenumberfmt.isValidNumber("15812312312"); ``` @@ -669,9 +669,9 @@ Formats a phone number. | string | Formatted phone number.| **Example** - ``` + ```js var phonenumberfmt = new i18n.PhoneNumberFormat("CN"); - phonenumberfmt.format("15812312312"); + phonenumberfmt.isValidNumber("15812312312"); ``` ### getLocationName9+ @@ -694,11 +694,10 @@ Obtains the home location of a phone number. | string | Home location of the phone number.| **Example** + ```js + var phonenumberfmt = new i18n.PhoneNumberFormat("CN"); + phonenumberfmt.isValidNumber("15812312312"); ``` - var location = i18n.PhoneNumberFormat.getLocationName('15812312345', 'zh-CN'); - ``` - - ## PhoneNumberFormatOptions8+ @@ -750,7 +749,7 @@ Converts one measurement unit into another and formats the unit based on the spe | string | Character string obtained after formatting based on the measurement unit specified by **toUnit**.| **Example** - ``` + ```js i18n.Util.unitConvert({unit: "cup", measureSystem: "US"}, {unit: "liter", measureSystem: "SI"}, 1000, "en-US", "long"); ``` @@ -797,7 +796,7 @@ Creates an **IndexUtil** object. | [IndexUtil](#indexutil8) | **IndexUtil** object mapping to the specified locale.| **Example** - ``` + ```js var indexUtil= i18n.getInstance("zh-CN"); ``` @@ -819,7 +818,7 @@ Obtains the index list for this **locale** object. | Array<string> | Index list for this **locale** object.| **Example** - ``` + ```js var indexUtil = i18n.getInstance("zh-CN"); var indexList = indexUtil.getIndexList(); ``` @@ -839,7 +838,7 @@ Adds the index of the new **locale** object to the index list. | locale | string | Yes | A string containing locale information, including the language, optional script, and region.| **Example** - ``` + ```js var indexUtil = i18n.getInstance("zh-CN"); indexUtil.addLocale("en-US"); ``` @@ -864,7 +863,7 @@ Obtains the index of a text object. | string | Index of the **text** object.| **Example** - ``` + ```js var indexUtil= i18n.getInstance("zh-CN"); indexUtil.getIndex("hi"); // Return h. ``` @@ -892,7 +891,7 @@ Checks whether the input character string is composed of digits. | boolean | Returns **true** if the input character is a digit; returns **false** otherwise.| **Example** - ``` + ```js var isdigit = i18n.Character.isDigit("1"); // Return true. ``` @@ -916,7 +915,7 @@ Checks whether the input character is a space. | boolean | Returns **true** if the input character is a space; returns **false** otherwise.| **Example** - ``` + ```js var isspacechar = i18n.Character.isSpaceChar("a"); // Return false. ``` @@ -940,7 +939,7 @@ Checks whether the input character is a white space. | boolean | Returns **true** if the input character is a white space; returns **false** otherwise.| **Example** - ``` + ```js var isspacechar = i18n.Character.isSpaceChar("a"); // Return false. ``` @@ -964,7 +963,7 @@ Checks whether the input character is of the right to left (RTL) language. | boolean | Returns **true** if the input character is of the RTL language; returns **false** otherwise.| **Example** - ``` + ```js var isrtl = i18n.Character.isRTL("a"); // Return false. ``` @@ -988,7 +987,7 @@ Checks whether the input character is an ideographic character. | boolean | Returns **true** if the input character is an ideographic character; returns **false** otherwise.| **Example** - ``` + ```js var isideograph = i18n.Character.isIdeograph("a"); // Return false. ``` @@ -1012,7 +1011,7 @@ Checks whether the input character is a letter. | boolean | Returns **true** if the input character is a letter; returns **false** otherwise.| **Example** - ``` + ```js var isletter = i18n.Character.isLetter("a"); // Return true. ``` @@ -1036,7 +1035,7 @@ Checks whether the input character is a lowercase letter. | boolean | Returns **true** if the input character is a lowercase letter; returns **false** otherwise.| **Example** - ``` + ```js var islowercase = i18n.Character.isLowerCase("a"); // Return true. ``` @@ -1060,7 +1059,7 @@ Checks whether the input character is an uppercase letter. | boolean | Returns **true** if the input character is an uppercase letter; returns **false** otherwise.| **Example** - ``` + ```js var isuppercase = i18n.Character.isUpperCase("a"); // Return false. ``` @@ -1084,7 +1083,7 @@ Obtains the type of the input character string. | string | Type of the input character.| **Example** - ``` + ```js var type = i18n.Character.getType("a"); ``` @@ -1108,7 +1107,7 @@ Obtains a [BreakIterator](#breakiterator8) object for text segmentation. | [BreakIterator](#breakiterator8) | [BreakIterator](#breakiterator8) object used for text segmentation.| **Example** - ``` + ```js var iterator = i18n.getLineInstance("en"); ``` @@ -1130,7 +1129,7 @@ Sets the text to be processed by the [BreakIterator](#breakiterator8) object. | text | string | Yes | Text to be processed by the **BreakIterator** object.| **Example** - ``` + ```js var iterator = i18n.getLineInstance("en"); iterator.setLineBreakText("Apple is my favorite fruit."); ``` @@ -1150,7 +1149,7 @@ Obtains the text being processed by the [BreakIterator](#breakiterator8) object. | string | Text being processed by the **BreakIterator** object.| **Example** - ``` + ```js var iterator = i18n.getLineInstance("en"); iterator.setLineBreakText("Apple is my favorite fruit."); iterator.getLineBreakText(); // Apple is my favorite fruit. @@ -1171,7 +1170,7 @@ Obtains the position of the [BreakIterator](#breakiterator8) object in the text | number | Position of the **BreakIterator** object in the text being processed.| **Example** - ``` + ```js var iterator = i18n.getLineInstance("en"); iterator.setLineBreakText("Apple is my favorite fruit."); iterator.current(); // 0 @@ -1192,7 +1191,7 @@ Puts the [BreakIterator](#breakiterator8) object to the first text boundary, whi | number | Offset to the first text boundary of the processed text.| **Example** - ``` + ```js var iterator = i18n.getLineInstance("en"); iterator.setLineBreakText("Apple is my favorite fruit."); iterator.first(); // 0 @@ -1213,7 +1212,7 @@ Puts the [BreakIterator](#breakiterator8) object to the last text boundary, whic | number | Offset of the last text boundary of the processed text.| **Example** - ``` + ```js var iterator = i18n.getLineInstance("en"); iterator.setLineBreakText("Apple is my favorite fruit."); iterator.last(); // 27 @@ -1239,7 +1238,7 @@ Moves the [BreakIterator](#breakiterator8) object backward by the specified numb | number | Position of the [BreakIterator](#breakiterator8) object in the text after it is moved by the specified number of text boundaries. The value **-1** is returned if the position of the [BreakIterator](#breakiterator8) object is outside of the processed text after it is moved by the specified number of text boundaries.| **Example** - ``` + ```js var iterator = i18n.getLineInstance("en"); iterator.setLineBreakText("Apple is my favorite fruit."); iterator.first(); // 0 @@ -1262,7 +1261,7 @@ Moves the [BreakIterator](#breakiterator8) object to the previous text boundary. | number | Position of the [BreakIterator](#breakiterator8) object in the text after it is moved to the previous text boundary. The value **-1** is returned if the position of the [BreakIterator](#breakiterator8) object is outside of the processed text after it is moved by the specified number of text boundaries.| **Example** - ``` + ```js var iterator = i18n.getLineInstance("en"); iterator.setLineBreakText("Apple is my favorite fruit."); iterator.first(); // 0 @@ -1290,7 +1289,7 @@ Moves the [BreakIterator](#breakiterator8) object to the text boundary after the | number | The value **-1** is returned if the text boundary to which the [BreakIterator](#breakiterator8) object is moved is outside of the processed text.| **Example** - ``` + ```js var iterator = i18n.getLineInstance("en"); iterator.setLineBreakText("Apple is my favorite fruit."); iterator.following(0); // 6 @@ -1318,7 +1317,7 @@ Checks whether the position specified by the offset is a text boundary. If **tru | boolean | Returns **true** if the position specified by the offset is a text boundary; returns **false** otherwise.| **Example** - ``` + ```js var iterator = i18n.getLineInstance("en"); iterator.setLineBreakText("Apple is my favorite fruit."); iterator.isBoundary(0); // true; @@ -1340,7 +1339,7 @@ Checks whether the 24-hour clock is used. | boolean | Returns **true** if the 24-hour clock is used; returns **false** otherwise.| **Example** - ``` + ```js var is24HourClock = i18n.is24HourClock(); ``` @@ -1366,7 +1365,7 @@ Sets the 24-hour clock. | boolean | Returns **true** if the 24-hour clock is enabled; returns **false** otherwise.| **Example** - ``` + ```js // Set the system time to the 24-hour clock. var success = i18n.set24HourClock(true); ``` @@ -1394,7 +1393,7 @@ Adds a preferred language to the specified position on the preferred language li | boolean | Returns **true** if the preferred language is successfully added; returns **false** otherwise.| **Example** - ``` + ```js // Add zh-CN to the preferred language list. var language = 'zh-CN'; var index = 0; @@ -1423,7 +1422,7 @@ Deletes a preferred language from the specified position on the preferred langua | boolean | Returns **true** if the preferred language is deleted; returns **false** otherwise.| **Example** - ``` + ```js // Delete the first preferred language from the preferred language list. var index = 0; var success = i18n.removePreferredLanguage(index); @@ -1444,7 +1443,7 @@ Obtains the list of preferred languages. | Array<string> | List of preferred languages.| **Example** - ``` + ```js var preferredLanguageList = i18n.getPreferredLanguageList(); ``` @@ -1463,7 +1462,7 @@ Obtains the first language in the preferred language list. | string | First language in the preferred language list.| **Example** - ``` + ```js var firstPreferredLanguage = i18n.getFirstPreferredLanguage(); ``` @@ -1482,7 +1481,7 @@ Obtains the preferred language of an application. | string | Preferred language of the application.| **Example** - ``` + ```js var appPreferredLanguage = i18n.getAppPreferredLanguage(); ``` @@ -1506,7 +1505,7 @@ Obtains the **TimeZone** object corresponding to the specified time zone ID. | TimeZone | **TimeZone** object corresponding to the time zone ID.| **Example** - ``` + ```js var timezone = i18n.getTimeZone(); ``` @@ -1528,7 +1527,7 @@ Obtains the ID of the specified **TimeZone** object. | string | Time zone ID corresponding to the **TimeZone** object.| **Example** - ``` + ```js var timezone = i18n.getTimeZone(); timezone.getID(); ``` @@ -1554,7 +1553,7 @@ Obtains the representation of a **TimeZone** object in the specified locale. | string | Representation of the **TimeZone** object in the specified locale.| **Example** - ``` + ```js var timezone = i18n.getTimeZone(); timezone.getDisplayName("zh-CN", false); ``` @@ -1574,7 +1573,7 @@ Obtains the offset between the time zone represented by a **TimeZone** object an | number | Offset between the time zone represented by the **TimeZone** object and the UTC time zone.| **Example** - ``` + ```js var timezone = i18n.getTimeZone(); timezone.getRawOffset(); ``` @@ -1594,7 +1593,7 @@ Obtains the offset between the time zone represented by a **TimeZone** object an | number | Offset between the time zone represented by the **TimeZone** object and the UTC time zone at a certain time point.| **Example** - ``` + ```js var timezone = i18n.getTimeZone(); timezone.getOffset(1234567890); ``` @@ -1613,7 +1612,7 @@ Obtains the list of time zone IDs supported by the system. | Array<string> | List of time zone IDs supported by the system.| **Example** - ``` + ```js var ids = i18n.TimeZone.getAvailableIDs(); ``` @@ -1632,7 +1631,7 @@ Obtains the list of time zone city IDs supported by the system. | Array<string> | List of time zone city IDs supported by the system.| **Example** - ``` + ```js var cityIDs = i18n.TimeZone.getAvailableZoneCityIDs(); ``` @@ -1657,7 +1656,7 @@ Obtains the localized display of a time zone city in the specified locale. | string | Localized display of the time zone city in the specified locale.| **Example** - ``` + ```js var displayName = i18n.TimeZone.getCityDisplayName("Shanghai", "zh-CN"); ``` @@ -1681,7 +1680,7 @@ Obtains the **TimeZone** object corresponding to the specified time zone city ID | TimeZone | **TimeZone** object corresponding to the specified time zone city ID.| **Example** - ``` + ```js var timezone = i18n.TimeZone.getTimezoneFromCity("Shanghai"); ``` @@ -1708,7 +1707,7 @@ This is a system API. | boolean | Result indicating whether the local digit switch is successfully set. The value **true** indicates that the local digit switch is successfully set, and the value **false** indicates the opposite.| **Example** - ``` + ```js var status = i18n.setUsingLocalDigit(true); ``` @@ -1727,7 +1726,7 @@ Checks whether the local digit switch is turned on. | boolean | Result indicating whether the local digit switch is turned on. The value **true** indicates that the local digit switch is turned on, and the value **false** indicates the opposite.| **Example** - ``` + ```js var status = i18n.getUsingLocalDigit(); ``` diff --git a/en/application-dev/reference/apis/js-apis-inputconsumer.md b/en/application-dev/reference/apis/js-apis-inputconsumer.md index c7662424d0b5bbde7888fe9dd696b177f532dcd5..98529f06257e7d2dfe3e9a395fd176dd413bb347 100644 --- a/en/application-dev/reference/apis/js-apis-inputconsumer.md +++ b/en/application-dev/reference/apis/js-apis-inputconsumer.md @@ -32,7 +32,7 @@ This is a system API. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Type of the key input event to listen for. Only **key** is supported.| -| keyOptions | [keyOptions](#keyOptions) | Yes| Key option, which specifies the condition for combination key input.| +| keyOptions | [keyOptions](#keyoptions) | Yes| Key option, which specifies the condition for combination key input.| | callback | Callback<KeyOptions> | Yes| Callback used to return the result.
When a key input event that meets the specified options occurs, **keyOptions** will be passed as an input parameter to **callback**.| **Example** @@ -62,7 +62,7 @@ This is a system API. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Type of the key input event to listen for. Only **key** is supported.| -| keyOptions | [keyOptions](#keyOptions) | Yes| Key options passed to the key input event when listening starts.| +| keyOptions | [keyOptions](#keyoptions) | Yes| Key options passed to the key input event when listening starts.| | callback | Callback<KeyOptions> | Yes| Callback function passed to the key input event with **keyOptions** when listening starts.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-inputdevice.md b/en/application-dev/reference/apis/js-apis-inputdevice.md index 178313a1ff1a83a905895656793ff5977a486d0d..2f4986f90f431852a7b2e76d8f58e24ba8469ed9 100644 --- a/en/application-dev/reference/apis/js-apis-inputdevice.md +++ b/en/application-dev/reference/apis/js-apis-inputdevice.md @@ -4,7 +4,8 @@ The Input Device module implements listening for connection, disconnection, and update events of input devices and displays information about input devices. For example, it can be used to listen for mouse insertion and removal and obtain information such as the ID, name, and pointer speed of the mouse. -> **NOTE**
+> **NOTE** +> > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -28,7 +29,7 @@ Enables listening for hot swap events of an input device. | Name | Type | Mandatory | Description | | -------- | ---------------------------------------- | ---- | ----------- | | type | string | Yes | Event type of the input device. | -| listener | Callback<[DeviceListener](#devicelistener9+)> | Yes | Listener for events of the input device.| +| listener | Callback<[DeviceListener](#devicelistener9)> | Yes | Listener for events of the input device.| **Example** @@ -63,7 +64,7 @@ Disables listening for hot swap events of an input device. | Name | Type | Mandatory | Description | | -------- | ---------------------------------------- | ---- | ----------- | | type | string | Yes | Event type of the input device. | -| listener | Callback<[DeviceListener](#devicelistener9+)> | No | Listener for events of the input device.| +| listener | Callback<[DeviceListener](#devicelistener9)> | No | Listener for events of the input device.| **Example** @@ -245,7 +246,7 @@ Obtains the keyboard type of an input device. This API uses an asynchronous call | Name | Type | Mandatory | Description | | -------- | ---------------------------------------- | ---- | --------------------------------- | | deviceId | number | Yes | Unique ID of the input device. If the same physical device is repeatedly inserted and removed, its ID changes.| -| callback | AsyncCallback<[KeyboardType](#keyboardtype)> | Yes | Callback used to return the result. | +| callback | AsyncCallback<[KeyboardType](#keyboardtype9)> | Yes | Callback used to return the result. | **Example** @@ -268,7 +269,7 @@ Obtains the keyboard type of an input device. This API uses a promise to return | Parameter | Description | | ---------------------------------------- | ------------------- | -| Promise<[KeyboardType](#keyboardtype)> | Promise used to return the result.| +| Promise<[KeyboardType](#keyboardtype9)> | Promise used to return the result.| **Example** @@ -336,7 +337,7 @@ Defines the axis range of an input device. | Name | Type | Description | | ----------------------- | ------------------------- | -------- | | source | [SourceType](#sourcetype) | Input source type of the axis.| -| axis | [AxisType](#axistype) | Axis type. | +| axis | [AxisType](#axistype9) | Axis type. | | max | number | Maximum value of the axis. | | min | number | Minimum value of the axis. | | fuzz9+ | number | Fuzzy value of the axis. | @@ -358,7 +359,7 @@ Enumerates the input source types. For example, if a mouse reports an x-axis eve | touchpad | string | The input device is a touchpad.| | joystick | string | The input device is a joystick.| -## ChangeType +## ChangedType Defines the change type for the hot swap event of an input device. diff --git a/en/application-dev/reference/apis/js-apis-inputmethod.md b/en/application-dev/reference/apis/js-apis-inputmethod.md index fa10d1c9b41f587ecfa8a86ff60e1abc24473fbc..47f0d3429179406f598940f977baab87ef7b3482 100644 --- a/en/application-dev/reference/apis/js-apis-inputmethod.md +++ b/en/application-dev/reference/apis/js-apis-inputmethod.md @@ -126,7 +126,7 @@ Switches to another input method. This API uses a promise to return the result. ``` ## InputMethodController -In the following API examples, you must first use **[getInputMethodController](#inputmethodgetinputmethodcontroller)** to obtain an **InputMethodController** instance, and then call the APIs using the obtained instance. +In the following API examples, you must first use [getInputMethodController](#inputmethodgetinputmethodcontroller) to obtain an **InputMethodController** instance, and then call the APIs using the obtained instance. ### stopInput @@ -174,7 +174,7 @@ Hides the keyboard. This API uses an asynchronous callback to return the result. ## InputMethodSetting8+ -In the following API examples, you must first use **[getInputMethodSetting](#inputmethodgetinputmethodcontroller)** to obtain an **InputMethodSetting** instance, and then call the APIs using the obtained instance. +In the following API examples, you must first use [getInputMethodSetting](#inputmethodgetinputmethodcontroller) to obtain an **InputMethodSetting** instance, and then call the APIs using the obtained instance. ### listInputMethod diff --git a/en/application-dev/reference/apis/js-apis-intl.md b/en/application-dev/reference/apis/js-apis-intl.md index d9be9b9a2cbc59fb48e2beae81da77d05be9c84f..3060af2da4bd047461f0cce0d866753bd8caf36a 100644 --- a/en/application-dev/reference/apis/js-apis-intl.md +++ b/en/application-dev/reference/apis/js-apis-intl.md @@ -536,7 +536,7 @@ Parameters **Example** ``` - var pluralRules= new Intl.PluraRules("zh-CN", {"localeMatcher": "lookup", "type": "cardinal"}); + var pluralRules= new Intl.PluralRules("zh-CN", {"localeMatcher": "lookup", "type": "cardinal"}); ``` diff --git a/en/application-dev/reference/apis/js-apis-update.md b/en/application-dev/reference/apis/js-apis-update.md index 64d76026eeb3981fd589401d71f599fc2112f9dd..1cad2b9d5796f5039d62124ff9543c77d7dc48f1 100644 --- a/en/application-dev/reference/apis/js-apis-update.md +++ b/en/application-dev/reference/apis/js-apis-update.md @@ -7,7 +7,7 @@ There are two types of updates: SD card update and over the air (OTA) update. - The SD card update depends on the update packages and SD cards. - The OTA update depends on the server deployed by the device manufacturer for managing update packages. The OTA server IP address is passed by the caller. The request interface is fixed and developed by the device manufacturer. -> **NOTE** +> **Note:** > > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > @@ -29,9 +29,9 @@ Obtains an **OnlineUpdater** object. **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | --------------------------- | ---- | ---- | -| upgradeInfo | [UpgradeInfo](#upgradeinfo) | Yes | **UpgradeInfo** object.| +| Name | Type | Mandatory | Description | +| ----------- | --------------------------- | ---- | ------ | +| upgradeInfo | [UpgradeInfo](#upgradeinfo) | Yes | **UpgradeInfo** object.| **Return value** @@ -41,7 +41,7 @@ Obtains an **OnlineUpdater** object. **Example** -``` +```ts try { var upgradeInfo = { upgradeApp: "com.ohos.ota.updateclient", @@ -67,13 +67,13 @@ Obtains a **Restorer** object for restoring factory settings. **Return value** -| Type | Description | -| ------------------- | ---- | +| Type | Description | +| --------------------- | ------ | | [Restorer](#restorer) | **Restorer** object for restoring factory settings.| **Example** -``` +```ts try { let restorer = update.getRestorer(); } catch(error) { @@ -91,13 +91,13 @@ Obtains a **LocalUpdater** object. **Return value** -| Type | Description | -| ------------------- | ---- | +| Type | Description | +| ----------------------------- | ------ | | [LocalUpdater](#localupdater) | **LocalUpdater** object.| **Example** -``` +```ts try { let localUpdater = update.getLocalUpdater(); } catch(error) { @@ -119,13 +119,13 @@ Checks whether a new version is available. This API uses an asynchronous callbac **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | -------------- | | callback | AsyncCallback\<[CheckResult](#checkresult)> | Yes | Callback used to return the result.| **Example** -``` +```ts updater.checkNewVersion((err, result) => { console.log(`checkNewVersion isExistNewVersion ${result?.isExistNewVersion}`); }); @@ -143,13 +143,13 @@ Checks whether a new version is available. This API uses a promise to return the **Return value** -| Type | Description | -| ---------------------------------------- | ---------------- | +| Type | Description | +| ------------------------------------- | ------------------- | | Promise\<[CheckResult](#checkresult)> | Promise used to return the result.| **Example** -``` +```ts updater.checkNewVersion().then(result => { console.log(`checkNewVersion isExistNewVersion: ${result.isExistNewVersion}`); // Version digest information @@ -171,13 +171,13 @@ Obtains information about the new version. This API uses an asynchronous callbac **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | --------------- | | callback | AsyncCallback\<[NewVersionInfo](#newversioninfo)> | Yes | Callback used to return the result.| **Example** -``` +```ts updater.getNewVersionInfo((err, info) => { console.log(`info displayVersion = ${info?.versionComponents[0].displayVersion}`); console.log(`info innerVersion = ${info?.versionComponents[0].innerVersion}`); @@ -196,13 +196,13 @@ Obtains information about the new version. This API uses a promise to return the **Return value** -| Type | Description | -| ---------------------------------------- | ---------------- | +| Type | Description | +| ---------------------------------------- | -------------------- | | Promise\<[NewVersionInfo](#newversioninfo)> | Promise used to return the result.| **Example** -``` +```ts updater.getNewVersionInfo().then(info => { console.log(`info displayVersion = ${info.versionComponents[0].displayVersion}`); console.log(`info innerVersion = ${info.versionComponents[0].innerVersion}`); @@ -223,15 +223,15 @@ Obtains the description file of the new version. This API uses an asynchronous c **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | -| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information.| -| descriptionOptions | [DescriptionOptions](#descriptionoptions) | Yes | Options of the description file.| -| callback | AsyncCallback\>) | Yes | Callback used to return the result.| +| Name | Type | Mandatory | Description | +| ------------------ | ---------------------------------------- | ---- | -------------- | +| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. | +| descriptionOptions | [DescriptionOptions](#descriptionoptions) | Yes | Options of the description file. | +| callback | AsyncCallback\>) | Yes | Callback used to return the result.| **Example** -``` +```ts // Version digest information var versionDigestInfo = { versionDigest: "versionDigest" // Version digest information in the check result @@ -261,20 +261,20 @@ Obtains the description file of the new version. This API uses a promise to retu **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | -| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information.| +| Name | Type | Mandatory | Description | +| ------------------ | ---------------------------------------- | ---- | ------ | +| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information.| | descriptionOptions | [DescriptionOptions](#descriptionoptions) | Yes | Options of the description file.| **Return value** -| Type | Description | -| ---------------------------------------- | ---------------- | +| Type | Description | +| ---------------------------------------- | ------------------- | | Promise\> | Promise used to return the result.| **Example** -``` +```ts // Version digest information var versionDigestInfo = { versionDigest: "versionDigest" // Version digest information in the check result @@ -305,13 +305,13 @@ Obtains information about the current version. This API uses an asynchronous cal **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------- | | callback | AsyncCallback\<[CurrentVersionInfo](#currentversioninfo)> | Yes | Callback used to return the result.| **Example** -``` +```ts updater.getCurrentVersionInfo((err, info) => { console.log(`info osVersion = ${info?.osVersion}`); console.log(`info deviceName = ${info?.deviceName}`); @@ -331,13 +331,13 @@ Obtains information about the current version. This API uses a promise to return **Return value** -| Type | Description | -| ---------------------------------------- | ---------------- | +| Type | Description | +| ---------------------------------------- | ------------------- | | Promise\<[CurrentVersionInfo](#currentversioninfo)> | Promise used to return the result.| **Example** -``` +```ts updater.getCurrentVersionInfo().then(info => { console.log(`info osVersion = ${info.osVersion}`); console.log(`info deviceName = ${info.deviceName}`); @@ -359,14 +359,14 @@ Obtains the description file of the current version. This API uses an asynchrono **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | -| descriptionOptions | [DescriptionOptions](#descriptionoptions) | Yes | Options of the description file.| -| callback | AsyncCallback\>) | Yes | Callback used to return the result.| +| Name | Type | Mandatory | Description | +| ------------------ | ---------------------------------------- | ---- | --------------- | +| descriptionOptions | [DescriptionOptions](#descriptionoptions) | Yes | Options of the description file. | +| callback | AsyncCallback\>) | Yes | Callback used to return the result.| **Example** -``` +```ts // Options of the description file var descriptionOptions = { format: DescriptionFormat.STANDARD, // Standard format @@ -391,19 +391,19 @@ Obtains the description file of the current version. This API uses a promise to **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | +| Name | Type | Mandatory | Description | +| ------------------ | ---------------------------------------- | ---- | ------ | | descriptionOptions | [DescriptionOptions](#descriptionoptions) | Yes | Options of the description file.| **Return value** -| Type | Description | -| ---------------------------------------- | ---------------- | +| Type | Description | +| ---------------------------------------- | -------------------- | | Promise\> | Promise used to return the result.| **Example** -``` +```ts // Options of the description file var descriptionOptions = { format: DescriptionFormat.STANDARD, // Standard format @@ -429,13 +429,13 @@ Obtains information about the update task. This API uses an asynchronous callbac **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | +| Name | Type | Mandatory | Description | +| -------- | ------------------------------------- | ---- | ---------------- | | callback | AsyncCallback\<[TaskInfo](#taskinfo)> | Yes | Callback used to return the result.| **Example** -``` +```ts updater.getTaskInfo((err, info) => { console.log(`getTaskInfo isexistTask= ${info?.existTask}`); }); @@ -453,13 +453,13 @@ Obtains information about the update task. This API uses a promise to return the **Return value** -| Type | Description | -| ---------------------------------------- | ---------------- | +| Type | Description | +| ------------------------------- | ------------------- | | Promise\<[TaskInfo](#taskinfo)> | Promise used to return the result.| **Example** -``` +```ts updater.getTaskInfo().then(info => { console.log(`getTaskInfo isexistTask= ${info.existTask}`); }).catch(err => { @@ -479,15 +479,15 @@ Downloads the new version. This API uses an asynchronous callback to return the **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | -| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information.| -| downloadOptions | [DownloadOptions](#downloadoptions) | Yes | Download options.| -| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| +| Name | Type | Mandatory | Description | +| ----------------- | --------------------------------------- | ---- | ---------------------------------- | +| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. | +| downloadOptions | [DownloadOptions](#downloadoptions) | Yes | Download options. | +| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| **Example** -``` +```ts // Version digest information var versionDigestInfo = { versionDigest: "versionDigest" // Version digest information in the check result @@ -515,20 +515,20 @@ Downloads the new version. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | +| Name | Type | Mandatory | Description | +| ----------------- | --------------------------------------- | ---- | ------ | | versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information.| -| downloadOptions | [DownloadOptions](#downloadoptions) | Yes | Download options.| +| downloadOptions | [DownloadOptions](#downloadoptions) | Yes | Download options. | **Return value** -| Type | Description | -| ---------------------------------------- | ---------------- | +| Type | Description | +| -------------- | -------------------------- | | Promise\ | Promise that returns no value.| **Example** -``` +```ts // Version digest information var versionDigestInfo = { versionDigest: "versionDigest" // Version digest information in the check result @@ -558,15 +558,15 @@ Resumes download of the new version. This API uses an asynchronous callback to r **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | -| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information.| -| resumeDownloadOptions | [ResumeDownloadOptions](#resumedownloadoptions) | Yes | Options for resuming download.| -| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| +| Name | Type | Mandatory | Description | +| --------------------- | ---------------------------------------- | ---- | ------------------------------------ | +| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. | +| resumeDownloadOptions | [ResumeDownloadOptions](#resumedownloadoptions) | Yes | Options for resuming download. | +| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| **Example** -``` +```ts // Version digest information var versionDigestInfo = { versionDigest: "versionDigest" // Version digest information in the check result @@ -593,20 +593,20 @@ Resumes download of the new version. This API uses a promise to return the resul **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | -| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information.| +| Name | Type | Mandatory | Description | +| --------------------- | ---------------------------------------- | ---- | ------ | +| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information.| | resumeDownloadOptions | [ResumeDownloadOptions](#resumedownloadoptions) | Yes | Options for resuming download.| **Return value** -| Type | Description | -| ---------------------------------------- | ---------------- | +| Type | Description | +| -------------- | -------------------------- | | Promise\ | Promise that returns no value.| **Example** -``` +```ts // Version digest information var versionDigestInfo = { versionDigest: "versionDigest" // Version digest information in the check result @@ -635,15 +635,15 @@ Pauses download of the new version. This API uses an asynchronous callback to re **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | -| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information.| -| pauseDownloadOptions | [PauseDownloadOptions](#pausedownloadoptions) | Yes | Options for pausing download.| -| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| +| Name | Type | Mandatory | Description | +| -------------------- | ---------------------------------------- | ---- | ------------------------------------ | +| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. | +| pauseDownloadOptions | [PauseDownloadOptions](#pausedownloadoptions) | Yes | Options for pausing download. | +| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| **Example** -``` +```ts // Version digest information var versionDigestInfo = { versionDigest: "versionDigest" // Version digest information in the check result @@ -670,20 +670,20 @@ Resumes download of the new version. This API uses a promise to return the resul **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | -| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information.| +| Name | Type | Mandatory | Description | +| -------------------- | ---------------------------------------- | ---- | ------ | +| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information.| | pauseDownloadOptions | [PauseDownloadOptions](#pausedownloadoptions) | Yes | Options for pausing download.| **Return value** -| Type | Description | -| ---------------------------------------- | ---------------- | +| Type | Description | +| -------------- | -------------------------- | | Promise\ | Promise that returns no value.| **Example** -``` +```ts // Version digest information var versionDigestInfo = { versionDigest: "versionDigest" // Version digest information in the check result @@ -712,15 +712,15 @@ Updates the version. This API uses an asynchronous callback to return the result **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | -| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information.| -| upgradeOptions | [UpgradeOptions](#upgradeoptions) | Yes | Update options.| -| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| +| Name | Type | Mandatory | Description | +| ----------------- | --------------------------------------- | ---- | ------------------------------------ | +| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. | +| upgradeOptions | [UpgradeOptions](#upgradeoptions) | Yes | Update options. | +| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| **Example** -``` +```ts // Version digest information var versionDigestInfo = { versionDigest: "versionDigest" // Version digest information in the check result @@ -747,20 +747,20 @@ Updates the version. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | +| Name | Type | Mandatory | Description | +| ----------------- | --------------------------------------- | ---- | ------ | | versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information.| -| upgradeOptions | [UpgradeOptions](#upgradeoptions) | Yes | Update options.| +| upgradeOptions | [UpgradeOptions](#upgradeoptions) | Yes | Update options. | **Return value** -| Type | Description | -| ---------------------------------------- | ---------------- | +| Type | Description | +| -------------- | -------------------------- | | Promise\ | Promise that returns no value.| **Example** -``` +```ts // Version digest information var versionDigestInfo = { versionDigest: "versionDigest" // Version digest information in the check result @@ -789,15 +789,15 @@ Clears errors. This API uses an asynchronous callback to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | -| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information.| -| clearOptions | [ClearOptions](#clearoptions) | Yes | Clear options.| -| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| +| Name | Type | Mandatory | Description | +| ----------------- | --------------------------------------- | ---- | ------------------------------------ | +| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. | +| clearOptions | [ClearOptions](#clearoptions) | Yes | Clear options. | +| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| **Example** -``` +```ts // Version digest information var versionDigestInfo = { versionDigest: "versionDigest" // Version digest information in the check result @@ -824,20 +824,20 @@ Clears errors. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | +| Name | Type | Mandatory | Description | +| ----------------- | --------------------------------------- | ---- | ------ | | versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information.| -| clearOptions | [ClearOptions](#clearoptions) | Yes | Update options.| +| clearOptions | [ClearOptions](#clearoptions) | Yes | Update options. | **Return value** -| Type | Description | -| ---------------------------------------- | ---------------- | +| Type | Description | +| -------------- | -------------------------- | | Promise\ | Promise that returns no value.| **Example** -``` +```ts // Version digest information var versionDigestInfo = { versionDigest: "versionDigest" // Version digest information in the check result @@ -866,13 +866,13 @@ Obtains the update policy. This API uses an asynchronous callback to return the **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | ---------- | +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | --------------- | | callback | AsyncCallback\<[UpgradePolicy](#upgradepolicy)> | Yes | Callback used to return the result.| **Example** -``` +```ts updater.getUpgradePolicy((err, policy) => { console.log(`policy downloadStrategy = ${policy?.downloadStrategy}`); console.log(`policy autoUpgradeStrategy = ${policy?.autoUpgradeStrategy}`); @@ -891,13 +891,13 @@ Obtains the update policy. This API uses a promise to return the result. **Return value** -| Type | Description | -| --------------------------------------- | ----------------- | +| Type | Description | +| ---------------------------------------- | --------------------- | | Promise\<[UpgradePolicy](#upgradepolicy)> | Promise used to return the result.| **Example** -``` +```ts updater.getUpgradePolicy().then(policy => { console.log(`policy downloadStrategy = ${policy.downloadStrategy}`); console.log(`policy autoUpgradeStrategy = ${policy.autoUpgradeStrategy}`); @@ -918,14 +918,14 @@ Sets the update policy. This API uses an asynchronous callback to return the res **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | ---------- | -| policy | [UpgradePolicy](#upgradepolicy) | Yes | Update policy.| -| callback | AsyncCallback\ | Yes | Callback used to return the result.| +| Name | Type | Mandatory | Description | +| -------- | ------------------------------- | ---- | ------------- | +| policy | [UpgradePolicy](#upgradepolicy) | Yes | Update policy. | +| callback | AsyncCallback\ | Yes | Callback used to return the result.| **Example** -``` +```ts let policy = { downloadStrategy: false, autoUpgradeStrategy: false, @@ -948,19 +948,19 @@ Sets the update policy. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ----------------------------- | ---- | ------ | +| Name | Type | Mandatory | Description | +| ------ | ------------------------------- | ---- | ---- | | policy | [UpgradePolicy](#upgradepolicy) | Yes | Update policy.| **Return value** -| Type | Description | -| ---------------- | --------------- | +| Type | Description | +| -------------- | ------------------- | | Promise\ | Promise used to return the result.| **Example** -``` +```ts let policy = { downloadStrategy: false, autoUpgradeStrategy: false, @@ -985,13 +985,13 @@ Terminates the update. This API uses an asynchronous callback to return the resu **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | -| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| +| Name | Type | Mandatory | Description | +| -------- | -------------------- | ---- | -------------------------------------- | +| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| **Example** -``` +```ts updater.terminateUpgrade((err) => { console.log(`terminateUpgrade error ${JSON.stringify(err)}`); }); @@ -1009,13 +1009,13 @@ Terminates the update. This API uses a promise to return the result. **Return value** -| Type | Description | -| ---------------------------------------- | ---------------- | +| Type | Description | +| -------------- | -------------------------- | | Promise\ | Promise that returns no value.| **Example** -``` +```ts updater.terminateUpgrade().then(() => { console.log(`terminateUpgrade success`); }).catch(err => { @@ -1033,14 +1033,14 @@ Enables listening for update events. This API uses an asynchronous callback to r **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | -| eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo) | Yes | Event information.| -| taskCallback | [UpgradeTaskCallback](#upgradetaskcallback) | Yes | Event callback.| +| Name | Type | Mandatory | Description | +| ----------------- | ---------------------------------------- | ---- | ---- | +| eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo) | Yes | Event information.| +| taskCallback | [UpgradeTaskCallback](#upgradetaskcallback) | Yes | Event callback.| **Example** -``` +```ts var eventClassifyInfo = { eventClassify: update.EventClassify.TASK, // Listening for update events extraInfo: "" @@ -1060,14 +1060,14 @@ Disables listening for update events. This API uses an asynchronous callback to **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | -| eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo) | Yes | Event information.| -| taskCallback | [UpgradeTaskCallback](#upgradetaskcallback) | No | Event callback.| +| Name | Type | Mandatory | Description | +| ----------------- | ---------------------------------------- | ---- | ---- | +| eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo) | Yes | Event information.| +| taskCallback | [UpgradeTaskCallback](#upgradetaskcallback) | No | Event callback.| **Example** -``` +```ts var eventClassifyInfo = { eventClassify: update.EventClassify.TASK, // Listening for update events extraInfo: "" @@ -1084,7 +1084,7 @@ updater.off(eventClassifyInfo, (eventInfo) => { factoryReset(callback: AsyncCallback\): void -Restores factory settings. This API uses an asynchronous callback to return the result. +Restore the device to its factory settings. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Update.UpdateService @@ -1092,13 +1092,13 @@ Restores factory settings. This API uses an asynchronous callback to return the **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | -| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| +| Name | Type | Mandatory | Description | +| -------- | -------------------- | ---- | -------------------------------------- | +| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| **Example** -``` +```ts restorer.factoryReset((err) => { console.log(`factoryReset error ${JSON.stringify(err)}`); }); @@ -1108,7 +1108,7 @@ restorer.factoryReset((err) => { factoryReset(): Promise\ -Restores factory settings. This API uses a promise to return the result. +Restore the device to its factory settings. This API uses a promise to return the result. **System capability**: SystemCapability.Update.UpdateService @@ -1116,13 +1116,13 @@ Restores factory settings. This API uses a promise to return the result. **Return value** -| Type | Description | -| ---------------------------------------- | ---------------- | +| Type | Description | +| -------------- | -------------------------- | | Promise\ | Promise that returns no value.| **Example** -``` +```ts restorer.factoryReset().then(() => { console.log(`factoryReset success`); }).catch(err => { @@ -1144,15 +1144,15 @@ Verifies the update package. This API uses an asynchronous callback to return th **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | -| upgradeFile | [UpgradeFile](#upgradefile) | Yes | Update file.| -| certsFile | string | Yes | Path of the certificate file.| -| callback | AsyncCallback\ | Yes | Callback used to return the result.| +| Name | Type | Mandatory | Description | +| ----------- | --------------------------- | ---- | ---------------- | +| upgradeFile | [UpgradeFile](#upgradefile) | Yes | Update file. | +| certsFile | string | Yes | Path of the certificate file. | +| callback | AsyncCallback\ | Yes | Callback used to return the result.| **Example** -``` +```ts var upgradeFile = { fileType: update.ComponentType.OTA, // OTA package filePath: "path" // Path of the local update package @@ -1175,20 +1175,20 @@ Verifies the update package. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | -| upgradeFile | [UpgradeFile](#upgradefile) | Yes | Update file.| -| certsFile | string | Yes | Path of the certificate file.| +| Name | Type | Mandatory | Description | +| ----------- | --------------------------- | ---- | ------ | +| upgradeFile | [UpgradeFile](#upgradefile) | Yes | Update file. | +| certsFile | string | Yes | Path of the certificate file.| **Return value** -| Type | Description | -| ---------------------------------------- | ---------------- | +| Type | Description | +| -------------- | ---------------------- | | Promise\ | Promise used to return the result.| **Example** -``` +```ts var upgradeFile = { fileType: update.ComponentType.OTA, // OTA package filePath: "path" // Path of the local update package @@ -1211,14 +1211,14 @@ Installs the update package. This API uses an asynchronous callback to return th **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | -| upgradeFile | Array<[UpgradeFile](#upgradefile)> | Yes | Update file.| -| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| +| Name | Type | Mandatory | Description | +| ----------- | ---------------------------------- | ---- | --------------------------------------- | +| upgradeFile | Array<[UpgradeFile](#upgradefile)> | Yes | Update file. | +| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| **Example** -``` +```ts var upgradeFiles = [{ fileType: update.ComponentType.OTA, // OTA package filePath: "path" // Path of the local update package @@ -1241,13 +1241,13 @@ Installs the update package. This API uses a promise to return the result. **Return value** -| Type | Description | -| ---------------------------------------- | ---------------- | +| Type | Description | +| -------------- | -------------------------- | | Promise\ | Promise that returns no value.| **Example** -``` +```ts var upgradeFiles = [{ fileType: update.ComponentType.OTA, // OTA package filePath: "path" // Path of the local update package @@ -1268,14 +1268,14 @@ Enables listening for update events. This API uses an asynchronous callback to r **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | -| eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo) | Yes | Event information.| -| taskCallback | [UpgradeTaskCallback](#upgradetaskcallback) | Yes | Event callback.| +| Name | Type | Mandatory | Description | +| ----------------- | ---------------------------------------- | ---- | ---- | +| eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo) | Yes | Event information.| +| taskCallback | [UpgradeTaskCallback](#upgradetaskcallback) | Yes | Event callback.| **Example** -``` +```ts var eventClassifyInfo = { eventClassify: update.EventClassify.TASK, // Listening for update events extraInfo: "" @@ -1297,14 +1297,14 @@ Disables listening for update events. This API uses an asynchronous callback to **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | --------- | -| eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo) | Yes | Event information.| -| taskCallback | [UpgradeTaskCallback](#upgradetaskcallback) | Yes | Event callback.| +| Name | Type | Mandatory | Description | +| ----------------- | ---------------------------------------- | ---- | ---- | +| eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo) | Yes | Event information.| +| taskCallback | [UpgradeTaskCallback](#upgradetaskcallback) | Yes | Event callback.| **Example** -``` +```ts var eventClassifyInfo = { eventClassify: update.EventClassify.TASK, // Listening for update events extraInfo: "" @@ -1323,10 +1323,10 @@ Represents update information. **System capability**: SystemCapability.Update.UpdateService -| Name | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| upgradeApp | string | Yes | Application package name. | -| businessType | [BusinessType](#businesstype) | Yes | Update service type. | +| Name | Type | Mandatory | Description | +| ------------ | ----------------------------- | ---- | ------ | +| upgradeApp | string | Yes | Application package name. | +| businessType | [BusinessType](#businesstype) | Yes | Update service type.| ## BusinessType @@ -1334,10 +1334,10 @@ Enumerates update service types. **System capability**: SystemCapability.Update.UpdateService -| Name | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| vendor | [BusinessVendor](#businessvendor) | Yes | Application vendor. | -| subType | [BusinessSubType](#businesssubtype) | Yes | Update service sub-type. | +| Name | Type | Mandatory | Description | +| ------- | ----------------------------------- | ---- | ---- | +| vendor | [BusinessVendor](#businessvendor) | Yes | Application vendor. | +| subType | [BusinessSubType](#businesssubtype) | Yes | Type | ## CheckResult @@ -1345,10 +1345,10 @@ Represents the package check result. **System capability**: SystemCapability.Update.UpdateService -| Name | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| isExistNewVersion | bool | Yes | Whether a new version is available. | -| newVersionInfo | [NewVersionInfo](#newversioninfo) | No | Information about the new version. | +| Name | Type | Mandatory | Description | +| ----------------- | --------------------------------- | ---- | ------ | +| isExistNewVersion | bool | Yes | Whether a new version is available.| +| newVersionInfo | [NewVersionInfo](#newversioninfo) | No | Information about the new version. | ## NewVersionInfo @@ -1356,10 +1356,10 @@ Represents information about the new version. **System capability**: SystemCapability.Update.UpdateService -| Name | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. | -| versionComponents | Array\<[VersionComponent](#versioncomponent)> | Yes | Version components. | +| Name | Type | Mandatory | Description | +| ----------------- | ---------------------------------------- | ---- | ---- | +| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information.| +| versionComponents | Array\<[VersionComponent](#versioncomponent)> | Yes | Version components.| ## VersionDigestInfo @@ -1367,9 +1367,9 @@ Represents version digest information. **System capability**: SystemCapability.Update.UpdateService -| Name | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| versionDigest | string | Yes | Version digest information. | +| Name | Type | Mandatory | Description | +| ------------- | ------ | ---- | ---- | +| versionDigest | string | Yes | Version digest information.| ## VersionComponent @@ -1377,16 +1377,16 @@ Represents a version component. **System capability**: SystemCapability.Update.UpdateService -| Name | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| componentId | number | Yes | Component ID. | -| componentType | [ComponentType](#componentyype) | Yes | Component type. | -| upgradeAction | [UpgradeAction](#upgradeaction) | Yes | Update mode. | -| displayVersion | string | Yes | Display version number. | -| innerVersion | string | Yes | Internal version number. | -| size | number | Yes | Update package size. | -| effectiveMode | [EffectiveMode](#effectivemode) | Yes | Effective mode. | -| descriptionInfo | [DescriptionInfo](#descriptioninfo) | Yes | Information about the version description file. | +| Parameter | Type | Mandatory | Description | +| --------------- | ----------------------------------- | ---- | -------- | +| componentId | number | Yes | Component ID. | +| componentType | [ComponentType](#componenttype) | Yes | Component type. | +| upgradeAction | [UpgradeAction](#upgradeaction) | Yes | Update mode. | +| displayVersion | string | Yes | Display version number. | +| innerVersion | string | Yes | Internal version number. | +| size | number | Yes | Update package size. | +| effectiveMode | [EffectiveMode](#effectivemode) | Yes | Effective mode. | +| descriptionInfo | [DescriptionInfo](#descriptioninfo) | Yes | Information about the version description file.| ## DescriptionOptions @@ -1394,10 +1394,10 @@ Represents options of the description file. **System capability**: SystemCapability.Update.UpdateService -| Name | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| format | [DescriptionFormat](#descriptionformat) | Yes | Format of the description file. | -| language | string | Yes | Language of the description file. | +| Name | Type | Mandatory | Description | +| -------- | --------------------------------------- | ---- | ------ | +| format | [DescriptionFormat](#descriptionformat) | Yes | Format of the description file.| +| language | string | Yes | Language of the description file.| ## ComponentDescription @@ -1405,10 +1405,10 @@ Represents a component description file. **System capability**: SystemCapability.Update.UpdateService -| Name | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| componentId | string | Yes | Component ID. | -| descriptionInfo | [DescriptionInfo](#descriptioninfo) | Yes | Information about the description file. | +| Name | Type | Mandatory | Description | +| --------------- | ----------------------------------- | ---- | ------ | +| componentId | string | Yes | Component ID. | +| descriptionInfo | [DescriptionInfo](#descriptioninfo) | Yes | Information about the description file.| ## DescriptionInfo @@ -1416,10 +1416,10 @@ Represents information about the version description file. **System capability**: SystemCapability.Update.UpdateService -| Name | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| descriptionType | [DescriptionType](#descriptiontype) | Yes | Type of the description file. | -| content | string | Yes | Content of the description file. | +| Name | Type | Mandatory | Description | +| --------------- | ----------------------------------- | ---- | ------ | +| descriptionType | [DescriptionType](#descriptiontype) | Yes | Type of the description file.| +| content | string | Yes | Content of the description file.| ## CurrentVersionInfo @@ -1427,11 +1427,11 @@ Represents information about the current version. **System capability**: SystemCapability.Update.UpdateService -| Name | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| osVersion | string | Yes | System version number. | -| deviceName | string | Yes | Device name. | -| versionComponents | Array\<[VersionComponent](#vesioncomponent)> | No | Version components. | +| Name | Type | Mandatory | Description | +| ----------------- | ---------------------------------------- | ---- | ----- | +| osVersion | string | Yes | System version number.| +| deviceName | string | Yes | Device name. | +| versionComponents | Array\<[VersionComponent](#versioncomponent)> | No | Version components. | ## DownloadOptions @@ -1439,10 +1439,10 @@ Represents download options. **System capability**: SystemCapability.Update.UpdateService -| Name | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| allowNetwork | [NetType](#nettype) | Yes | Network type. | -| order | [Order](#order) | Yes | Update command. | +| Name | Type | Mandatory | Description | +| ------------ | ------------------- | ---- | ---- | +| allowNetwork | [NetType](#nettype) | Yes | Network type.| +| order | [Order](#order) | Yes | Update command.| ## ResumeDownloadOptions @@ -1450,9 +1450,9 @@ Represents options for resuming download. **System capability**: SystemCapability.Update.UpdateService -| Parameter | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| allowNetwork | [NetType](#nettype) | Yes | Network type. | +| Name | Type | Mandatory | Description | +| ------------ | ------------------- | ---- | ---- | +| allowNetwork | [NetType](#nettype) | Yes | Network type.| ## PauseDownloadOptions @@ -1460,9 +1460,9 @@ Represents options for pausing download. **System capability**: SystemCapability.Update.UpdateService -| Name | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| isAllowAutoResume | bool | Yes | Whether to allow automatic resuming of download. | +| Name | Type| Mandatory | Description | +| ----------------- | ---- | ---- | -------- | +| isAllowAutoResume | bool | Yes | Whether to allow automatic resuming of download.| ## UpgradeOptions @@ -1470,9 +1470,9 @@ Represents update options. **System capability**: SystemCapability.Update.UpdateService -| Name | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| order | [Order](#order) | Yes | Update command. | +| Name | Type | Mandatory | Description | +| ----- | --------------- | ---- | ---- | +| order | [Order](#order) | Yes | Update command.| ## ClearOptions @@ -1480,9 +1480,9 @@ Represents options for clearing errors. **System capability**: SystemCapability.Update.UpdateService -| Name | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| status | [UpgradeStatus](#upgradestatus) | Yes | Error status. | +| Name | Type | Mandatory | Description | +| ------ | ------------------------------- | ---- | ---- | +| status | [UpgradeStatus](#upgradestatus) | Yes | Error status.| ## UpgradePolicy @@ -1490,11 +1490,11 @@ Represents an update policy. **System capability**: SystemCapability.Update.UpdateService -| Name | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| downloadStrategy | bool | Yes | Automatic download policy. | -| autoUpgradeStrategy | bool | Yes | Automatic update policy. | -| autoUpgradePeriods | Array\<[UpgradePeriod](#upgradeperiod)> | Yes | Automatic update period.| +| Name | Type | Mandatory | Description | +| ------------------- | --------------------------------------- | ---- | ------- | +| downloadStrategy | bool | Yes | Automatic download policy. | +| autoUpgradeStrategy | bool | Yes | Automatic update policy. | +| autoUpgradePeriods | Array\<[UpgradePeriod](#upgradeperiod)> | Yes | Automatic update period.| ## UpgradePeriod @@ -1502,10 +1502,10 @@ Represents a period for automatic update. **System capability**: SystemCapability.Update.UpdateService -| Name | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| start | number | Yes | Start time. | -| end | number | Yes | End time. | +| Name | Type | Mandatory | Description | +| ----- | ------ | ---- | ---- | +| start | number | Yes | Start time.| +| end | number | Yes | End time.| ## TaskInfo @@ -1513,21 +1513,21 @@ Represents task information. **System capability**: SystemCapability.Update.UpdateService -| Name | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| existTask | bool | Yes | Whether a task exists. | -| taskBody | [TaskBody](#taskinfo) | Yes | Task data. | +| Name | Type | Mandatory | Description | +| --------- | --------------------- | ---- | ------ | +| existTask | bool | Yes | Whether a task exists.| +| taskBody | [TaskBody](#taskinfo) | Yes | Task data. | ## EventInfo -Represents event information. +Represents event type information. **System capability**: SystemCapability.Update.UpdateService -| Parameter | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| eventId | [EventId](#eventid) | Yes | Event ID. | -| taskBody | [TaskBody](#taskinfo) | Yes | Task data. | +| Name | Type | Mandatory | Description | +| -------- | --------------------- | ---- | ---- | +| eventId | [EventId](#eventid) | Yes | Event ID.| +| taskBody | [TaskBody](#taskinfo) | Yes | Task data.| ## TaskBody @@ -1535,15 +1535,15 @@ Represents task data. **System capability**: SystemCapability.Update.UpdateService -| Name | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. | -| status | [UpgradeStatus](#upgradestatus) | Yes | Update status. | -| subStatus | number | No | Sub-status. | -| progress | number | Yes | Progress. | -| installMode | number | Yes | Installation mode. | -| errorMessages | Array\<[ErrorMessage](#errormessage)> | No | Error message. | -| versionComponents | Array\<[VersionComponent](#versioncomponent)> | Yes | Version components. | +| Name | Type | Mandatory | Description | +| ----------------- | ---------------------------------------- | ---- | ---- | +| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information.| +| status | [UpgradeStatus](#upgradestatus) | Yes | Update status.| +| subStatus | number | No | Sub-status. | +| progress | number | Yes | Progress. | +| installMode | number | Yes | Installation mode.| +| errorMessages | Array\<[ErrorMessage](#errormessage)> | No | Error message.| +| versionComponents | Array\<[VersionComponent](#versioncomponent)> | Yes | Version components.| ## ErrorMessage @@ -1551,10 +1551,10 @@ Represents an error message. **System capability**: SystemCapability.Update.UpdateService -| Name | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| errorCode | number | Yes | Error code. | -| errorMessage | string | Yes | Error description. | +| Name | Type | Mandatory | Description | +| ------------ | ------ | ---- | ---- | +| errorCode | number | Yes | Error code. | +| errorMessage | string | Yes | Error description.| ## EventClassifyInfo @@ -1562,10 +1562,10 @@ Represents event type information. **System capability**: SystemCapability.Update.UpdateService -| Name | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| eventClassify | [EventClassify](#eventclassify) | Yes | Event type. | -| extraInfo | string | Yes | Additional information. | +| Name | Type | Mandatory | Description | +| ------------- | ------------------------------- | ---- | ---- | +| eventClassify | [EventClassify](#eventclassify) | Yes | Event type.| +| extraInfo | string | Yes | Additional information.| ## UpgradeFile @@ -1573,22 +1573,22 @@ Represents an update file. **System capability**: SystemCapability.Update.UpdateService -| Name | Type | Mandatory | Description | -| ------------------- | --------------------------- | ---- | ------- | -| fileType | [ComponentType](#componenttype) | Yes | File type. | -| filePath | string | Yes | File path. | +| Name | Type | Mandatory | Description | +| -------- | ------------------------------- | ---- | ---- | +| fileType | [ComponentType](#componenttype) | Yes | File type.| +| filePath | string | Yes | File path.| ## UpgradeTaskCallback ### (eventInfo: [EventInfo](#eventinfo)): void -Event callback. +Represents an event callback. **System capability**: SystemCapability.Update.UpdateService -| Parameter | Type | Mandatory | Description | -| --------------- | ---------------------------------------- | ---- | ---- | -| eventInfo | [EventInfo](#eventinfo) | Yes | Event information.| +| Name | Type | Mandatory | Description | +| --------- | ----------------------- | ---- | ---- | +| eventInfo | [EventInfo](#eventinfo) | Yes | Event information.| ## BusinessVendor @@ -1596,9 +1596,9 @@ Device vendor. **System capability**: SystemCapability.Update.UpdateService -| Name | Default Value | Description | -| ------------------- | ---- | -------- | -| PUBLIC | "public" | Open source. | +| Name | Default Value | Description | +| ------ | -------- | ---- | +| PUBLIC | "public" | Open source. | ## BusinessSubType @@ -1606,9 +1606,9 @@ Represents an update type. **System capability**: SystemCapability.Update.UpdateService -| Name | Default Value | Description | -| ------------------- | ---- | -------- | -| FIRMWARE | 1 | Firmware. | +| Name | Default Value | Description | +| -------- | ---- | ---- | +| FIRMWARE | 1 | Firmware. | ## ComponentType @@ -1616,9 +1616,9 @@ Represents a component type. **System capability**: SystemCapability.Update.UpdateService -| Name | Default Value | Description | -| ------------------- | ---- | -------- | -| OTA | 1 | Firmware. | +| Name | Default Value | Description | +| ---- | ---- | ---- | +| OTA | 1 | Firmware. | ## UpgradeAction @@ -1626,10 +1626,10 @@ Represents an update mode. **System capability**: SystemCapability.Update.UpdateService -| Name | Default Value | Description | -| ------------------- | ---- | -------- | -| UPGRADE | "upgrade" | Differential package. | -| RECOVERY | "recovery" | Recovery package. | +| Name | Default Value | Description | +| -------- | ---------- | ---- | +| UPGRADE | "upgrade" | Differential package. | +| RECOVERY | "recovery" | Recovery package. | ## EffectiveMode @@ -1637,11 +1637,11 @@ Represents an effective mode. **System capability**: SystemCapability.Update.UpdateService -| Name | Default Value | Description | -| ------------------- | ---- | -------- | -| COLD | 1 | Cold update. | -| LIVE | 2 | Live update. | -| LIVE_AND_COLD | 3 | Hybrid live and cold update. | +| Name | Default Value | Description | +| ------------- | ---- | ---- | +| COLD | 1 | Cold update. | +| LIVE | 2 | Live update. | +| LIVE_AND_COLD | 3 | Hybrid live and cold update.| ## DescriptionType @@ -1649,10 +1649,10 @@ Represents a description file type. **System capability**: SystemCapability.Update.UpdateService -| Name | Default Value | Description | -| ------------------- | ---- | -------- | -| CONTENT | 0 | Content. | -| URI | 1 | Link. | +| Name | Default Value | Description | +| ------- | ---- | ---- | +| CONTENT | 0 | Content. | +| URI | 1 | Link. | ## DescriptionFormat @@ -1660,10 +1660,10 @@ Represents a description file format. **System capability**: SystemCapability.Update.UpdateService -| Name | Default Value | Description | -| ------------------- | ---- | -------- | -| STANDARD | 0 | Standard format. | -| SIMPLIFIED | 1 | Simple format. | +| Name | Default Value | Description | +| ---------- | ---- | ---- | +| STANDARD | 0 | Standard format.| +| SIMPLIFIED | 1 | Simple format.| ## NetType @@ -1671,13 +1671,13 @@ Enumerates network types. **System capability**: SystemCapability.Update.UpdateService -| Name | Default Value | Description | -| ------------------- | ---- | -------- | -| CELLULAR | 1 | Data network. | -| METERED_WIFI | 2 | Wi-Fi hotspot. | -| NOT_METERED_WIFI | 4 | Non Wi-Fi hotspot. | -| WIFI | 6 | WIFI | -| CELLULAR_AND_WIFI | 7 | Data network and Wi-Fi. | +| Name | Default Value | Description | +| ----------------- | ---- | --------- | +| CELLULAR | 1 | Data network. | +| METERED_WIFI | 2 | Wi-Fi hotspot. | +| NOT_METERED_WIFI | 4 | Non Wi-Fi hotspot. | +| WIFI | 6 | Wi-Fi. | +| CELLULAR_AND_WIFI | 7 | Data network and Wi-Fi.| ## Order @@ -1685,13 +1685,13 @@ Represents an update command. **System capability**: SystemCapability.Update.UpdateService -| Name | Default Value | Description | -| ------------------- | ---- | -------- | -| DOWNLOAD | 1 | Download. | -| INSTALL | 2 | Install. | -| DOWNLOAD_AND_INSTALL | 3 | Download and install. | -| APPLY | 4 | Apply. | -| INSTALL_AND_APPLY | 6 | Install and apply. | +| Name | Default Value | Description | +| -------------------- | ---- | ----- | +| DOWNLOAD | 1 | Download. | +| INSTALL | 2 | Install. | +| DOWNLOAD_AND_INSTALL | 3 | Download and install.| +| APPLY | 4 | Apply. | +| INSTALL_AND_APPLY | 6 | Install and apply.| ## UpgradeStatus @@ -1699,18 +1699,18 @@ Enumerates update states. **System capability**: SystemCapability.Update.UpdateService -| Name | Default Value | Description | -| ------------------- | ---- | -------- | -| WAITING_DOWNLOAD | 20 | Waiting for download. | -| DOWNLOADING | 21 | Downloading. | -| DOWNLOAD_PAUSED | 22 | Download paused. | -| DOWNLOAD_FAIL | 23 | Download failed. | -| WAITING_INSTALL | 30 | Waiting for installation. | -| UPDATING | 31 | Updating. | -| WAITING_APPLY | 40 | Waiting for applying the update. | -| APPLYING | 21 | Applying the update. | -| UPGRADE_SUCCESS | 50 | Update succeeded. | -| UPGRADE_FAIL | 51 | Update failed. | +| Name | Default Value | Description | +| ---------------- | ---- | ---- | +| WAITING_DOWNLOAD | 20 | Waiting for download. | +| DOWNLOADING | 21 | Downloading. | +| DOWNLOAD_PAUSED | 22 | Download paused.| +| DOWNLOAD_FAIL | 23 | Download failed.| +| WAITING_INSTALL | 30 | Waiting for installation. | +| UPDATING | 31 | Updating. | +| WAITING_APPLY | 40 | Waiting for applying the update. | +| APPLYING | 21 | Applying the update. | +| UPGRADE_SUCCESS | 50 | Update succeeded.| +| UPGRADE_FAIL | 51 | Update failed.| ## EventClassify @@ -1718,9 +1718,9 @@ Represents an event type. **System capability**: SystemCapability.Update.UpdateService -| Name | Default Value | Description | -| ------------------- | ---- | -------- | -| TASK | 0x01000000 | Task event. | +| Name | Default Value | Description | +| ---- | ---------- | ---- | +| TASK | 0x01000000 | Task event.| ## EventId @@ -1728,22 +1728,22 @@ Enumerates event IDs. **System capability**: SystemCapability.Update.UpdateService -| Name | Default Value | Description | -| ------------------- | ---- | -------- | -| EVENT_TASK_BASE | 0x01000000 | Indicates a task event. | -| EVENT_TASK_RECEIVE | 0x01000001 | Indicates that a task is received. | -| EVENT_TASK_CANCEL | 0x01000010 | Indicates that a task is cancelled. | -| EVENT_DOWNLOAD_WAIT | 0x01000011 | Indicates the state of waiting for the download. | -| EVENT_DOWNLOAD_START | 0x01000100 | Indicates that the download starts. | -| EVENT_DOWNLOAD_UPDATE | 0x01000101 | Indicates the download progress update. | -| EVENT_DOWNLOAD_PAUSE | 0x01000110 | Indicates that the download is paused. | -| EVENT_DOWNLOAD_RESUME | 0x01000111 | Indicates that the download is resumed. | -| EVENT_DOWNLOAD_SUCCESS | 0x01001000 | Indicates that the download succeeded. | -| EVENT_DOWNLOAD_FAIL | 0x01001001 | Indicates that the download failed. | -| EVENT_UPGRADE_WAIT | 0x01001010 | Indicates the state of waiting for the update. | -| EVENT_UPGRADE_START | 0x01001011 | Indicates that the update starts. | -| EVENT_UPGRADE_UPDATE | 0x01001100 | Indicates that the update is in progress. | -| EVENT_APPLY_WAIT | 0x01001101 | Indicates the state of waiting for applying the update. | -| EVENT_APPLY_START | 0x01001110 | Indicates the state of applying the update. | -| EVENT_UPGRADE_SUCCESS | 0x01001111 | Indicates that the update succeeded. | -| EVENT_UPGRADE_FAIL | 0x01010000 | Indicates that the update failed. | +| Name | Default Value | Description | +| ---------------------- | ---------- | ------ | +| EVENT_TASK_BASE | 0x01000000 | Indicates a task event. | +| EVENT_TASK_RECEIVE | 0x01000001 | Indicates that a task is received. | +| EVENT_TASK_CANCEL | 0x01000010 | Indicates that a task is cancelled. | +| EVENT_DOWNLOAD_WAIT | 0x01000011 | Indicates the state of waiting for the download. | +| EVENT_DOWNLOAD_START | 0x01000100 | Indicates that the download starts. | +| EVENT_DOWNLOAD_UPDATE | 0x01000101 | Indicates the download progress update.| +| EVENT_DOWNLOAD_PAUSE | 0x01000110 | Indicates that the download is paused. | +| EVENT_DOWNLOAD_RESUME | 0x01000111 | Indicates that the download is resumed. | +| EVENT_DOWNLOAD_SUCCESS | 0x01001000 | Indicates that the download succeeded. | +| EVENT_DOWNLOAD_FAIL | 0x01001001 | Indicates that the download failed. | +| EVENT_UPGRADE_WAIT | 0x01001010 | Indicates the state of waiting for the update. | +| EVENT_UPGRADE_START | 0x01001011 | Indicates that the update starts. | +| EVENT_UPGRADE_UPDATE | 0x01001100 | Indicates that the update is in progress. | +| EVENT_APPLY_WAIT | 0x01001101 | Indicates the state of waiting for applying the update. | +| EVENT_APPLY_START | 0x01001110 | Indicates the state of applying the update. | +| EVENT_UPGRADE_SUCCESS | 0x01001111 | Indicates that the update succeeded. | +| EVENT_UPGRADE_FAIL | 0x01010000 | Indicates that the update failed. |