From 4d8b0e8501fbfd6e28a3e9643ee6bbef48ccb4b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=9B=E4=BA=9A=E8=8A=B3?= Date: Tue, 26 Apr 2022 10:26:47 +0000 Subject: [PATCH] update en/application-dev/reference/apis/js-apis-display.md. Signed-off-by: @ge-yafang --- .../reference/apis/js-apis-display.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/en/application-dev/reference/apis/js-apis-display.md b/en/application-dev/reference/apis/js-apis-display.md index faaf19c4db..1c65dc5b71 100644 --- a/en/application-dev/reference/apis/js-apis-display.md +++ b/en/application-dev/reference/apis/js-apis-display.md @@ -5,7 +5,7 @@ ## Modules to Import -``` +```js import display from '@ohos.display'; ``` @@ -64,7 +64,8 @@ Obtains the default display object. | callback | AsyncCallback<[Display](#display)> | Yes| Callback used to return the default display object.| - Example - ``` + + ```js var displayClass = null; display.getDefaultDisplay((err, data) => { if (err.code) { @@ -92,7 +93,7 @@ Obtains the default display object. - Example - ``` + ```js let promise = display.getDefaultDisplay(); promise.then(() => { console.log('getDefaultDisplay success'); @@ -117,7 +118,7 @@ Obtains all the display objects. - Example - ``` + ```js display.getAllDisplay((err, data) => { if (err.code) { console.error('Failed to obtain all the display objects. Code: ' + JSON.stringify(err)); @@ -143,7 +144,7 @@ Obtains all the display objects. - Example - ``` + ```js let promise = display.getAllDisplay(); promise.then(() => { console.log('getAllDisplay success'); @@ -167,7 +168,8 @@ Enables listening. | callback | Callback<number> | Yes| Callback used to return the ID of the display.| - Example - ``` + + ```js var type = "add"; var callback = (data) => { console.info('Listening enabled. Data: ' + JSON.stringify(data)) @@ -191,7 +193,8 @@ Disables listening. | callback | Callback<number> | No| Callback used to return the ID of the display.| - Example - ``` + + ```js var type = "remove"; display.off(type); ``` -- GitLab