• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Class (JsMessageExt)
2
3Implements a **JsMessageExt** object that is returned after the [runJavaScriptExt](./arkts-apis-webview-WebviewController.md#runjavascriptext10) API is invoked.
4
5> **NOTE**
6>
7> - The initial APIs of this module are supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version.
8>
9> - The initial APIs of this class are supported since API version 10.
10>
11> - You can preview how this component looks on a real device, but not in DevEco Studio Previewer.
12
13## getType<sup>10+</sup>
14
15getType(): JsMessageType
16
17Obtains the type of the data object. For details about the sample code, see [runJavaScriptExt](./arkts-apis-webview-WebviewController.md#runjavascriptext10).
18
19**System capability**: SystemCapability.Web.Webview.Core
20
21**Return value**
22
23| Type          | Description                                                     |
24| --------------| --------------------------------------------------------- |
25| [JsMessageType](./arkts-apis-webview-e.md#jsmessagetype10) | Data type of the result returned after the [runJavaScriptExt](./arkts-apis-webview-WebviewController.md#runjavascriptext10) API is executed.|
26
27## getString<sup>10+</sup>
28
29getString(): string
30
31Obtains string-type data of the data object. For details about the sample code, see [runJavaScriptExt](./arkts-apis-webview-WebviewController.md#runjavascriptext10).
32
33**System capability**: SystemCapability.Web.Webview.Core
34
35**Return value**
36
37| Type          | Description         |
38| --------------| ------------- |
39| string | Data of the string type.|
40
41**Error codes**
42
43For details about the error codes, see [Webview Error Codes](errorcode-webview.md).
44
45| Error Code| Error Message                             |
46| -------- | ------------------------------------- |
47| 17100014 | The type and value of the message do not match. |
48
49## getNumber<sup>10+</sup>
50
51getNumber(): number
52
53Obtains number-type data of the data object. For details about the sample code, see [runJavaScriptExt](./arkts-apis-webview-WebviewController.md#runjavascriptext10).
54
55**System capability**: SystemCapability.Web.Webview.Core
56
57**Return value**
58
59| Type          | Description         |
60| --------------| ------------- |
61| number | Data of the number type.|
62
63**Error codes**
64
65For details about the error codes, see [Webview Error Codes](errorcode-webview.md).
66
67| Error Code| Error Message                             |
68| -------- | ------------------------------------- |
69| 17100014 | The type and value of the message do not match. |
70
71## getBoolean<sup>10+</sup>
72
73getBoolean(): boolean
74
75Obtains Boolean-type data of the data object. For details about the sample code, see [runJavaScriptExt](./arkts-apis-webview-WebviewController.md#runjavascriptext10).
76
77**System capability**: SystemCapability.Web.Webview.Core
78
79**Return value**
80
81| Type          | Description         |
82| --------------| ------------- |
83| boolean | Data of the Boolean type.|
84
85**Error codes**
86
87For details about the error codes, see [Webview Error Codes](errorcode-webview.md).
88
89| Error Code| Error Message                             |
90| -------- | ------------------------------------- |
91| 17100014 | The type and value of the message do not match. |
92
93## getArrayBuffer<sup>10+</sup>
94
95getArrayBuffer(): ArrayBuffer
96
97Obtains raw binary data of the data object. For details about the sample code, see [runJavaScriptExt](./arkts-apis-webview-WebviewController.md#runjavascriptext10).
98
99**System capability**: SystemCapability.Web.Webview.Core
100
101**Return value**
102
103| Type          | Description         |
104| --------------| ------------- |
105| ArrayBuffer | Raw binary data.|
106
107**Error codes**
108
109For details about the error codes, see [Webview Error Codes](errorcode-webview.md).
110
111| Error Code| Error Message                             |
112| -------- | ------------------------------------- |
113| 17100014 | The type and value of the message do not match. |
114
115## getArray<sup>10+</sup>
116
117getArray(): Array\<string | number | boolean\>
118
119Obtains array-type data of the data object. For details about the sample code, see [runJavaScriptExt](./arkts-apis-webview-WebviewController.md#runjavascriptext10).
120
121**System capability**: SystemCapability.Web.Webview.Core
122
123**Return value**
124
125| Type          | Description         |
126| --------------| ------------- |
127| Array\<string \| number \| boolean\> | Data of the array type.|
128
129**Error codes**
130
131For details about the error codes, see [Webview Error Codes](errorcode-webview.md).
132
133| Error Code| Error Message                             |
134| -------- | ------------------------------------- |
135| 17100014 | The type and value of the message do not match. |
136