diff --git a/zh-cn/application-dev/reference/apis/js-apis-window.md b/zh-cn/application-dev/reference/apis/js-apis-window.md index ffd42e4a5d660baa88f17cc938d89b84c4c45ffd..c7255c1a11c04fe1b5a32359acbe2c45a7e3564a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-window.md +++ b/zh-cn/application-dev/reference/apis/js-apis-window.md @@ -4660,6 +4660,98 @@ try { } ``` +### setWaterMarkFlag10+ + +setWaterMarkFlag(enable: boolean): Promise<void> + +为当前窗口添加或删除安全水印标志,使用Promise异步回调。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | --- | ------------------------------------------------ | +| enable | boolean | 是 | 是否对窗口添加标志位。true表示添加,false表示删除。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ------------------------- | +| Promise<void> | 无返回结果的Promise对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[窗口错误码](../errorcodes/errorcode-window.md)。 + +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------------- | +| 1300002 | This window state is abnormal. | +| 1300003 | This window manager service works abnormally. | +| 1300008 | The operation is on invalid display. | + +**示例:** + +```js +try { + let enable = true; + let promise = windowClass.setWaterMarkFlag(enable); + promise.then(()=> { + console.info('Succeeded in setting water mark flag of window.'); + }).catch((err)=>{ + console.error('Failed to set water mark flag of window. Cause:' + JSON.stringify(err)); + }); +} catch (exception) { + console.error('Failed to set water mark flag of window. Cause: ' + JSON.stringify(exception)); +} +``` + +### setWaterMarkFlag10+ + +setWaterMarkFlag(enable: boolean, callback: AsyncCallback<void>): void + +为当前窗口添加或删除安全水印标志,使用callback异步回调。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | --- | ----------------------------------------------- | +| enable | boolean | 是 | 是否对窗口添加标志位。true表示添加,false表示删除。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**错误码:** + +以下错误码的详细介绍请参见[窗口错误码](../errorcodes/errorcode-window.md)。 + +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------------- | +| 1300002 | This window state is abnormal. | +| 1300003 | This window manager service works abnormally. | +| 1300008 | The operation is on invalid display. | + +**示例:** + +```js +try { + let enable = true; + windowClass.setWaterMarkFlag(enable, (err) => { + if (err.code) { + console.error('Failed to set water mark flag of window. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in setting water mark flag of window.'); + }); +} catch (exception) { + console.error('Failed to set water mark flag of window. Cause: ' + JSON.stringify(exception)); +} +``` + ### show(deprecated) show(callback: AsyncCallback<void>): void