提交 4978b75b 编写于 作者: E ester.zhou

Update docs (12508)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 ff0fb4a5
......@@ -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?
......
# @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.
......
# @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**
>
......
# @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.
......
# @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.
......
# @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**
>
......
# @ohos.curves
# @ohos.curves (Interpolation Calculation)
The **Curves** module provides APIs for interpolation calculation to create step, cubic Bezier, and spring curves.
......
# @ohos.deviceInfo
# @ohos.deviceInfo (Device Information)
The **deviceInfo** module provides product information.
> **NOTE**<br>
> **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
......
# @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.
......
# Environment
# @ohos.environment (Directory Environment Capability)
The **Environment** module provides APIs for obtaining the root directories of the storage and public files.
......
# InputMethodExtensionAbility
# @ohos.inputmethodextensionability (InputMethodExtensionAbility)
The **InputMethodExtensionAbility** module provides APIs for developing input methods and managing their lifecycles.
......
# @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.
......
# @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.
......
# @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.
......
# @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.
......
# @ohos.mediaquery
# @ohos.mediaquery (Media Query)
The **mediaquery** module provides different styles for different media types.
......
# 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<sup>(deprecated)</sup>
......@@ -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 = "<!DOCTYPE html>\n" + "<html>\n" + "<head>\n" + "<meta charset=\"utf-8\">\n" + "<title>HTML-PASTEBOARD_HTML</title>\n" + "</head>\n" + "<body>\n" + " <h1>HEAD</h1>\n" + " <p></p>\n" + "</body>\n" + "</html>";
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 = "<!DOCTYPE html>\n" + "<html>\n" + "<head>\n" + "<meta charset=\"utf-8\">\n" + "<title>HTML-PASTEBOARD_HTML</title>\n" + "</head>\n" + "<body>\n" + " <h1>HEAD</h1>\n" + " <p></p>\n" + "</body>\n" + "</html>";
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<sup>(deprecated)</sup>
......
# @ohos.prompt
# @ohos.prompt (Prompt)
The **Prompt** module provides APIs for creating and showing toasts, dialog boxes, and action menus.
......
# @ohos.promptAction
# @ohos.promptAction (Prompt)
The **PromptAction** module provides APIs for creating and showing toasts, dialog boxes, and action menus.
......
# @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.
......
# @ohos.settings
# @ohos.settings (Data Item Settings)
The **settings** module provides APIs for setting data items.
......
# @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}`);
}
```
......
# @system.device
# @system.device (Device Information)
The **device** module provides APIs for checking information about the current device.
......
# 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
......
# @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
......
# 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
......
# Prompt
# @system.prompt (Prompt)
The **PromptAction** module provides APIs for creating and showing toasts, dialog boxes, and action menus.
> **NOTE**
>
......
# @system.router
# @system.router (Page Routing)
The **Router** module provides APIs to access pages through URIs.
......
# @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}`);
}
}
}
```
# @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.
......
# @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.
......
# @ohos.web.webview
# @ohos.web.webview (Webview)
The **Webview** module provides APIs for web control.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册