diff --git a/api/@ohos.inputMethodEngine.d.ts b/api/@ohos.inputMethodEngine.d.ts index ba7993665199844c3a3cab797338991e62297a8a..1ad120fd24ba8a1420ea5169d70da868da365302 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;