console.info('Succeeded in obtaining all the display objects. Data: '+JSON.stringify(data));
}).catch((err)=>{
console.error('Failed to obtain all the display objects. Code: '+JSON.stringify(err));
});
```
## display.hasPrivateWindow<sup>9+</sup>
hasPrivateWindow(displayId: number): boolean
Checks whether there is a visible privacy window on a display. The privacy window can be set by calling **[setPrivacyMode](js-apis-window.md#setprivacymode7)**. The content in the privacy window cannot be captured or recorded.
Checks whether there is a visible privacy window on a display. The privacy window can be set by calling `[setPrivacyMode](js-apis-window.md#setprivacymode7)`. The content in the privacy window cannot be captured or recorded.
|boolean | Whether there is a visible privacy window on the display.<br>The value **true** means that there is a visible privacy window on the display, and **false** means the opposite.<br>|
|boolean | Whether there is a visible privacy window on the display.<br>The value `true` means that there is a visible privacy window on the display, and `false` means the opposite.<br>|
**Example**
```js
varret=display.hasPrivateWindow(displayClass.id);
if(ret==undefined){
console.log("HasPrivateWindow undefined.");
}
if(ret){
console.log("HasPrivateWindow.");
}elseif(!ret){
console.log("Don't HasPrivateWindow.");
```js
vardisplayClass=null;
display.getDefaultDisplay((err,data)=>{
if(err.code){
console.error('Failed to obtain the default display object. Code: '+JSON.stringify(err));
return;
}
```
console.info('Succeeded in obtaining the default display object. Data:'+JSON.stringify(data));
displayClass=data;
});
varret=display.hasPrivateWindow(displayClass.id);
if(ret==undefined){
console.log("Failed to check has privateWindow or not.");
}
if(ret){
console.log("There has privateWindow.");
}elseif(!ret){
console.log("There has no privateWindow.");
}
```
## display.on('add'|'remove'|'change')
...
...
@@ -219,19 +246,20 @@ Subscribes to display changes.
| type | string | Yes| Event type.<br>- **add**, indicating the display addition event.<br>- **remove**, indicating the display removal event.<br>- **change**, indicating the display change event.|
| callback | Callback<number> | No| Callback used to return the ID of the display.|
**Example**
```js
display.off("remove");
```
```js
display.off("remove");
```
## Display
Implements a `Display` instance, with properties and APIs defined.
To call an API in the following API examples, you must first use `[getAllDisplay()](#displaygetalldisplay)`, `[getDefaultDisplay()](#displaygetdefaultdisplay)`, or `[getDefaultDisplaySync()](#displaygetdefaultdisplaysync)` to obtain a `Display` instance.
| callback | AsyncCallback<[CutoutInfo](#cutoutinfo9)> | Yes | Callback used to If the operation is successful, `err` is `undefined` and `data` is the `CutoutInfo` object obtained. Otherwise, `err` is an error object.|
**Example**
```js
displayClass.getCutoutInfo((err,data)=>{
if(err.code){
console.error('Failed to get cutoutInfo. Cause: '+JSON.stringify(err));
return;
}
console.info('Succeeded in getting cutoutInfo. data: '+JSON.stringify(data));
})
```
### getCutoutInfo<sup>9+</sup>
getCutoutInfo(): Promise<CutoutInfo>
Obtains the cutout information of the display. This API uses a promise to return the result.