diff --git a/runtime/main/extend/systemplugin/napi/ohos_window.js b/runtime/main/extend/systemplugin/napi/ohos_window.js index f08f66d1..b8956f9c 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_window.js +++ b/runtime/main/extend/systemplugin/napi/ohos_window.js @@ -31,7 +31,9 @@ export const WindowType = { TYPE_LAUNCHER_RECENT: 11, TYPE_LAUNCHER_DOCK: 12, TYPE_VOICE_INTERACTION: 13, - TYPE_POINTER: 14 + TYPE_POINTER: 14, + TYPE_FLOAT_CAMERA: 15, + TYPE_DIALOG: 16 } export const AvoidAreaType= { @@ -534,7 +536,7 @@ export const Window = { if (typeof args[len - 1] === 'function') { if (args[0] === 'keyboardHeightChange'|| args[0] === 'systemAvoidAreaChange' || args[0] === 'windowSizeChange'|| args[0] === 'touchOutside'|| args[0] === 'avoidAreaChange' - || args[0] === 'screenshot' + || args[0] === 'screenshot' || args[0] === 'dialogTargetTouch' ){ console.warn(`Window.on you has registered ${args[0]} event`) } else { @@ -551,7 +553,7 @@ export const Window = { if (typeof args[len - 1] === 'function') { if (args[0] === 'keyboardHeightChange'|| args[0] === 'systemAvoidAreaChange' || args[0] === 'windowSizeChange'|| args[0] === 'touchOutside'|| args[0] === 'avoidAreaChange' - || args[0] === 'screenshot' + || args[0] === 'screenshot' || args[0] === 'dialogTargetTouch' ){ console.warn(`Window.off you has registered ${args[0]} event`) } else { @@ -609,6 +611,21 @@ export const Window = { }) } }, + bindDialogTarget: function(...args) { + console.warn("Window.bindDialogTarget interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + /* 参数带有function,需特殊判断,原型如下 */ + /* bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback): Promise; */ + /* bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback, callback: AsyncCallback); */ + if (typeof args[len - 2] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) + } + }, } export const windowMock = Window