• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.InputMethodExtensionAbility (InputMethodExtensionAbility)
2
3The **InputMethodExtensionAbility** module provides APIs for developing input methods and managing their lifecycles.
4
5> **NOTE**
6>
7> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8
9## Modules to Import
10
11```js
12import InputMethodExtensionAbility from '@ohos.InputMethodExtensionAbility';
13```
14
15## Attributes
16
17**System capability**: SystemCapability.MiscServices.InputMethodFramework
18
19| Name| Type| Readable| Writable| Description|
20| -------- | -------- | -------- | -------- | -------- |
21| context | [InputMethodExtensionContext](js-apis-inputmethod-extension-context.md) | Yes| No| Context of the **InputMethodExtension**, which is inherited from **ExtensionContext**.|
22
23## InputMethodExtensionAbility.onCreate
24
25onCreate(want: Want): void
26
27Called when the **InputMethodExtension** ability is started to implement initialization.
28
29**System capability**: SystemCapability.MiscServices.InputMethodFramework
30
31**Parameters**
32
33| Name| Type         | Mandatory| Description                            |
34| ------ | ----------- | ---- | ------------------------------- |
35| want   | [Want](js-apis-app-ability-want.md) | Yes  | Information related to the **InputMethodExtension** ability, including the ability name and bundle name.|
36
37**Example**
38
39```js
40class InputMethodExt extends InputMethodExtensionAbility {
41    onCreate(want) {
42        console.log('onCreate, want:' + want.abilityName);
43    }
44}
45```
46
47## InputMethodExtensionAbility.onDestroy
48
49onDestroy(): void
50
51Called when this **InputMethodExtension** ability is destroyed to clear resources.
52
53**System capability**: SystemCapability.MiscServices.InputMethodFramework
54
55**Example**
56
57```js
58class InputMethodExt extends InputMethodExtensionAbility {
59    onDestroy() {
60        console.log('onDestroy');
61    }
62}
63```
64