From d2b9445532995cc48ba89759f38d2ef36593b902 Mon Sep 17 00:00:00 2001 From: qianyong325 Date: Wed, 28 May 2025 17:05:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0inputWillDisconnect=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: qianyong325 --- api/@ohos.inputMethodEngine.d.ts | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/api/@ohos.inputMethodEngine.d.ts b/api/@ohos.inputMethodEngine.d.ts index ba79936651..1ad120fd24 100644 --- a/api/@ohos.inputMethodEngine.d.ts +++ b/api/@ohos.inputMethodEngine.d.ts @@ -577,6 +577,28 @@ declare namespace inputMethodEngine { */ off(type: 'inputStop', callback: () => void): void; + /** + * Subscribe 'inputWillDisconnect'. + * + * @param { 'inputStop' } type - the type of subscribe event. + * @param { Callback } callback - the callback of on('inputWillDisconnect'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 20 + * @arkts 1.2 + */ + on(type: 'inputWillDisconnect', callback: ( reason :InputDisconnectReason) => void): void; + + /** + * Unsubscribe 'inputWillDisconnect'. + * + * @param { 'inputStop' } type - the type of Unsubscribe event. + * @param { function } callback - optional,the callback of on('inputWillDisconnect'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 20 + * @arkts 1.2 + */ + off(type: 'inputWillDisconnect', callback?: ( reason :InputDisconnectReason) => void): void; + /** * Subscribe 'setCallingWindow'. * @@ -2829,6 +2851,33 @@ declare namespace inputMethodEngine { */ CHARACTERS } + + /** + * Enumerates the input disconnect reason. + * + * @enum { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 20 + * @arkts 1.2 + */ + export enum InputDisconnectReason { + /** + * Focus switch. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 20 + * @arkts 1.2 + */ + FOCUS_SWITCH = 0, + /** + * Switch input method. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 20 + * @arkts 1.2 + */ + INPUT_METHOD_SWITCH + } } export default inputMethodEngine; -- Gitee