未验证 提交 4d8b0e85 编写于 作者: 葛亚芳 提交者: Gitee

update en/application-dev/reference/apis/js-apis-display.md.

Signed-off-by: N@ge-yafang <geyafang@huawei.com>
上级 7655f34c
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
## Modules to Import ## Modules to Import
``` ```js
import display from '@ohos.display'; import display from '@ohos.display';
``` ```
...@@ -64,7 +64,8 @@ Obtains the default display object. ...@@ -64,7 +64,8 @@ Obtains the default display object.
| callback | AsyncCallback&lt;[Display](#display)&gt; | Yes| Callback used to return the default display object.| | callback | AsyncCallback&lt;[Display](#display)&gt; | Yes| Callback used to return the default display object.|
- Example - Example
```
```js
var displayClass = null; var displayClass = null;
display.getDefaultDisplay((err, data) => { display.getDefaultDisplay((err, data) => {
if (err.code) { if (err.code) {
...@@ -92,7 +93,7 @@ Obtains the default display object. ...@@ -92,7 +93,7 @@ Obtains the default display object.
- Example - Example
``` ```js
let promise = display.getDefaultDisplay(); let promise = display.getDefaultDisplay();
promise.then(() => { promise.then(() => {
console.log('getDefaultDisplay success'); console.log('getDefaultDisplay success');
...@@ -117,7 +118,7 @@ Obtains all the display objects. ...@@ -117,7 +118,7 @@ Obtains all the display objects.
- Example - Example
``` ```js
display.getAllDisplay((err, data) => { display.getAllDisplay((err, data) => {
if (err.code) { if (err.code) {
console.error('Failed to obtain all the display objects. Code: ' + JSON.stringify(err)); console.error('Failed to obtain all the display objects. Code: ' + JSON.stringify(err));
...@@ -143,7 +144,7 @@ Obtains all the display objects. ...@@ -143,7 +144,7 @@ Obtains all the display objects.
- Example - Example
``` ```js
let promise = display.getAllDisplay(); let promise = display.getAllDisplay();
promise.then(() => { promise.then(() => {
console.log('getAllDisplay success'); console.log('getAllDisplay success');
...@@ -167,7 +168,8 @@ Enables listening. ...@@ -167,7 +168,8 @@ Enables listening.
| callback | Callback&lt;number&gt; | Yes| Callback used to return the ID of the display.| | callback | Callback&lt;number&gt; | Yes| Callback used to return the ID of the display.|
- Example - Example
```
```js
var type = "add"; var type = "add";
var callback = (data) => { var callback = (data) => {
console.info('Listening enabled. Data: ' + JSON.stringify(data)) console.info('Listening enabled. Data: ' + JSON.stringify(data))
...@@ -191,7 +193,8 @@ Disables listening. ...@@ -191,7 +193,8 @@ Disables listening.
| callback | Callback&lt;number&gt; | No| Callback used to return the ID of the display.| | callback | Callback&lt;number&gt; | No| Callback used to return the ID of the display.|
- Example - Example
```
```js
var type = "remove"; var type = "remove";
display.off(type); display.off(type);
``` ```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册