From 4f03a6f3c1aafb3e91e8c21d6d1b3212eaeb2f83 Mon Sep 17 00:00:00 2001 From: guojin31 Date: Thu, 13 Jul 2023 20:39:26 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=BE=93=E5=85=A5=E6=B3=95=E6=A1=86?= =?UTF-8?q?=E6=9E=B6=E3=80=91=E4=BA=8B=E4=BB=B6=E8=AE=A2=E9=98=85API?= =?UTF-8?q?=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: guojin31 --- api/@ohos.InputMethodSubtype.d.ts | 3 +- api/@ohos.inputMethod.d.ts | 65 ++++++++++++++++++++----------- api/@ohos.inputMethodEngine.d.ts | 2 +- 3 files changed, 45 insertions(+), 25 deletions(-) diff --git a/api/@ohos.InputMethodSubtype.d.ts b/api/@ohos.InputMethodSubtype.d.ts index b22408dc6e..1e03e17166 100644 --- a/api/@ohos.InputMethodSubtype.d.ts +++ b/api/@ohos.InputMethodSubtype.d.ts @@ -32,6 +32,7 @@ export default interface InputMethodSubtype { /** * The label id of input method subtype. * + * @type { ?number } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ @@ -108,4 +109,4 @@ export default interface InputMethodSubtype { * @since 10 */ extra?: object; -} +} \ No newline at end of file diff --git a/api/@ohos.inputMethod.d.ts b/api/@ohos.inputMethod.d.ts index 848098ad5c..102a3ef978 100644 --- a/api/@ohos.inputMethod.d.ts +++ b/api/@ohos.inputMethod.d.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import { AsyncCallback } from './@ohos.base'; +import type { Callback, AsyncCallback } from './@ohos.base'; import InputMethodSubtype from './@ohos.InputMethodSubtype'; /** @@ -252,11 +252,11 @@ declare namespace inputMethod { ): void; /** - * Subscribe input window show event. + * Subscribes to input window show events. * * @param { 'imeShow' } type - Indicates the event type. * @param { function } callback - the callback of 'imeShow'. - * @throws { BusinessError } 201 - permissions check fails. + * @throws { BusinessError } 202 - not system application. * @syscap SystemCapability.MiscServices.InputMethodFramework * @systemapi * @since 10 @@ -276,11 +276,11 @@ declare namespace inputMethod { off(type: 'imeShow', callback?: (info: Array) => void): void; /** - * Subscribe input window hide event. + * Subscribes to input window hidden events. * * @param { 'imeHide' } type - Indicates the event type. * @param { function } callback - the callback of 'imeHide'. - * @throws { BusinessError } 201 - permissions check fails. + * @throws { BusinessError } 202 - not system application. * @syscap SystemCapability.MiscServices.InputMethodFramework * @systemapi * @since 10 @@ -767,6 +767,17 @@ declare namespace inputMethod { */ on(type: 'selectByRange', callback: Callback): void; + /** + * Unregister the callback of selectedByRange. + * + * @param { 'selectByRange' } type - event type, fixed as 'selectByRange'. + * @param { Callback } [callback] - the callback of 'selectByRange', + * when subscriber unsubscribes all callback functions of event 'selectByRange', this parameter can be left blank. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + off(type: 'selectByRange', callback?: Callback): void; + /** * Register a callback and when IME sends select event witch movement of cursor, * the callback will be invoked. @@ -781,23 +792,16 @@ declare namespace inputMethod { */ on(type: 'selectByMovement', callback: Callback): void; - /** - * Unregister the callback of selectedByRange. - * - * @param { 'selectByRange' } type - event type, fixed as 'selectByRange'. - * @syscap SystemCapability.MiscServices.InputMethodFramework - * @since 10 - */ - off(type: 'selectByRange'): void; - /** * Unregister the callback of selectedByMovement. * * @param { 'selectByMovement' } type - event type, fixed as 'selectByMovement'. + * @param { Callback } [callback] - the callback of 'selectByMovement', + * when subscriber unsubscribes all callback functions of event 'selectByMovement', this parameter can be left blank. * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ - off(type: 'selectByMovement'): void; + off(type: 'selectByMovement', callback?: Callback): void; /** * Register a callback and when IME sends insert text event, the callback will be invoked. @@ -816,10 +820,12 @@ declare namespace inputMethod { * Unregister the callback of insertText. * * @param { 'insertText' } type - event type, fixed as 'insertText'. + * @param { function } [callback] - the callback of 'insertText', + * when subscriber unsubscribes all callback functions of event 'insertText', this parameter can be left blank. * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ - off(type: 'insertText'): void; + off(type: 'insertText', callback?: (text: string) => void): void; /** * Register a callback and when IME sends delete left event with length, @@ -840,10 +846,12 @@ declare namespace inputMethod { * Unregister the callback of deleteLeft. * * @param { 'deleteLeft' } type - event type, fixed as 'deleteLeft'. + * @param { function } [callback] - the callback of 'deleteLeft', + * when subscriber unsubscribes all callback functions of event 'deleteLeft', this parameter can be left blank. * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ - off(type: 'deleteLeft'): void; + off(type: 'deleteLeft', callback?: (length: number) => void): void; /** * Register a callback and when IME sends delete right event with length, @@ -864,10 +872,12 @@ declare namespace inputMethod { * Unregister the callback of deleteRight. * * @param { 'deleteRight' } type - event type, fixed as 'deleteRight'. + * @param { function } [callback] - the callback of 'deleteRight', + * when subscriber unsubscribes all callback functions of event 'deleteRight', this parameter can be left blank. * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ - off(type: 'deleteRight'): void; + off(type: 'deleteRight', callback?: (length: number) => void): void; /** * Register a callback and when IME sends keyboard status, the callback will be invoked. @@ -886,10 +896,12 @@ declare namespace inputMethod { * Unregister the callback of sendKeyboardStatus. * * @param { 'sendKeyboardStatus' } type - event type, fixed as 'sendKeyboardStatus'. + * @param { function } [callback] - the callback of 'sendKeyboardStatus', + * when subscriber unsubscribes all callback functions of event 'sendKeyboardStatus', this parameter can be left blank. * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ - off(type: 'sendKeyboardStatus'): void; + off(type: 'sendKeyboardStatus', callback?: (keyBoardStatus: KeyboardStatus) => void): void; /** * Register a callback and when IME sends functionKey, the callback will be invoked. @@ -909,10 +921,12 @@ declare namespace inputMethod { * Unregister the callback of sendFunctionKey. * * @param { 'sendFunctionKey' } type - event type, fixed as 'sendFunctionKey'. + * @param { function } [callback] - the callback of 'sendFunctionKey', + * when subscriber unsubscribes all callback functions of event 'sendFunctionKey', this parameter can be left blank. * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ - off(type: 'sendFunctionKey'): void; + off(type: 'sendFunctionKey', callback?: (functionKey: FunctionKey) => void): void; /** * Register a callback and when IME sends move cursor, the callback will be invoked. @@ -932,10 +946,12 @@ declare namespace inputMethod { * Unregister the callback of moveCursor. * * @param { 'moveCursor' } type - event type, fixed as 'moveCursor'. + * @param { function } [callback] - the callback of 'moveCursor', + * when subscriber unsubscribes all callback functions of event 'moveCursor', this parameter can be left blank. * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ - off(type: 'moveCursor'): void; + off(type: 'moveCursor', callback?: (direction: Direction) => void): void; /** * Register a callback and when IME sends extend action code, the callback will be invoked. @@ -954,10 +970,12 @@ declare namespace inputMethod { * Unregister the callback of handleExtendAction. * * @param { 'handleExtendAction' } type - event type, fixed as 'handleExtendAction'. + * @param { function } [callback] - the callback of 'handleExtendAction', + * when subscriber unsubscribes all callback functions of event 'handleExtendAction', this parameter can be left blank. * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ - off(type: 'handleExtendAction'): void; + off(type: 'handleExtendAction', callback?: (action: ExtendAction) => void): void; /** * Register a callback and when input method ability gets left text of cursor, the callback will be invoked. @@ -1087,6 +1105,7 @@ declare namespace inputMethod { /** * The label id of input method * + * @type { ?number } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ @@ -1630,4 +1649,4 @@ declare namespace inputMethod { } } -export default inputMethod; +export default inputMethod; \ No newline at end of file diff --git a/api/@ohos.inputMethodEngine.d.ts b/api/@ohos.inputMethodEngine.d.ts index c187629b84..868a22c3bc 100644 --- a/api/@ohos.inputMethodEngine.d.ts +++ b/api/@ohos.inputMethodEngine.d.ts @@ -18,7 +18,7 @@ import { AsyncCallback } from './@ohos.base'; import type { KeyEvent as InputKeyEvent } from './@ohos.multimodalInput.keyEvent'; import InputMethodSubtype from './@ohos.InputMethodSubtype'; -import LocalStorage from 'StateManagement'; +import type { LocalStorage } from 'StateManagement'; import BaseContext from './application/BaseContext'; /**