@girs/javascriptcore-6.0 2.40.0-3.2.9 → 2.40.0-4.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/javascriptcore-6.0-ambient.d.ts +3 -3
- package/javascriptcore-6.0.d.ts +1139 -1576
- package/javascriptcore-6.0.js +0 -4
- package/package.json +10 -15
- package/javascriptcore-6.0.cjs +0 -11
- package/javascriptcore-6.0.d.cts +0 -1764
package/javascriptcore-6.0.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
/*
|
|
3
2
|
* Type Definitions for Gjs (https://gjs.guide/)
|
|
4
3
|
*
|
|
@@ -7,7 +6,7 @@
|
|
|
7
6
|
*/
|
|
8
7
|
|
|
9
8
|
import './javascriptcore-6.0-ambient.d.ts';
|
|
10
|
-
|
|
9
|
+
|
|
11
10
|
/**
|
|
12
11
|
* JavaScriptCore-6.0
|
|
13
12
|
*/
|
|
@@ -16,1754 +15,1318 @@ import type GObject from '@girs/gobject-2.0';
|
|
|
16
15
|
import type GLib from '@girs/glib-2.0';
|
|
17
16
|
|
|
18
17
|
export namespace JavaScriptCore {
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Enum values to specify a mode to check for syntax errors in jsc_context_check_syntax().
|
|
22
|
-
*/
|
|
23
|
-
enum CheckSyntaxMode {
|
|
24
18
|
/**
|
|
25
|
-
* mode to check syntax
|
|
19
|
+
* Enum values to specify a mode to check for syntax errors in jsc_context_check_syntax().
|
|
26
20
|
*/
|
|
27
|
-
|
|
21
|
+
enum CheckSyntaxMode {
|
|
22
|
+
/**
|
|
23
|
+
* mode to check syntax of a script
|
|
24
|
+
*/
|
|
25
|
+
SCRIPT,
|
|
26
|
+
/**
|
|
27
|
+
* mode to check syntax of a module
|
|
28
|
+
*/
|
|
29
|
+
MODULE,
|
|
30
|
+
}
|
|
28
31
|
/**
|
|
29
|
-
*
|
|
32
|
+
* Enum values to specify the result of jsc_context_check_syntax().
|
|
30
33
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
enum CheckSyntaxResult {
|
|
35
|
+
/**
|
|
36
|
+
* no errors
|
|
37
|
+
*/
|
|
38
|
+
SUCCESS,
|
|
39
|
+
/**
|
|
40
|
+
* recoverable syntax error
|
|
41
|
+
*/
|
|
42
|
+
RECOVERABLE_ERROR,
|
|
43
|
+
/**
|
|
44
|
+
* irrecoverable syntax error
|
|
45
|
+
*/
|
|
46
|
+
IRRECOVERABLE_ERROR,
|
|
47
|
+
/**
|
|
48
|
+
* unterminated literal error
|
|
49
|
+
*/
|
|
50
|
+
UNTERMINATED_LITERAL_ERROR,
|
|
51
|
+
/**
|
|
52
|
+
* out of memory error
|
|
53
|
+
*/
|
|
54
|
+
OUT_OF_MEMORY_ERROR,
|
|
55
|
+
/**
|
|
56
|
+
* stack overflow error
|
|
57
|
+
*/
|
|
58
|
+
STACK_OVERFLOW_ERROR,
|
|
59
|
+
}
|
|
37
60
|
/**
|
|
38
|
-
*
|
|
61
|
+
* Enum values for options types.
|
|
39
62
|
*/
|
|
40
|
-
|
|
63
|
+
enum OptionType {
|
|
64
|
+
/**
|
|
65
|
+
* A #gboolean option type.
|
|
66
|
+
*/
|
|
67
|
+
BOOLEAN,
|
|
68
|
+
/**
|
|
69
|
+
* A #gint option type.
|
|
70
|
+
*/
|
|
71
|
+
INT,
|
|
72
|
+
/**
|
|
73
|
+
* A #guint option type.
|
|
74
|
+
*/
|
|
75
|
+
UINT,
|
|
76
|
+
/**
|
|
77
|
+
* A #gsize options type.
|
|
78
|
+
*/
|
|
79
|
+
SIZE,
|
|
80
|
+
/**
|
|
81
|
+
* A #gdouble options type.
|
|
82
|
+
*/
|
|
83
|
+
DOUBLE,
|
|
84
|
+
/**
|
|
85
|
+
* A string option type.
|
|
86
|
+
*/
|
|
87
|
+
STRING,
|
|
88
|
+
/**
|
|
89
|
+
* A range string option type.
|
|
90
|
+
*/
|
|
91
|
+
RANGE_STRING,
|
|
92
|
+
}
|
|
41
93
|
/**
|
|
42
|
-
*
|
|
94
|
+
* Possible types of the elements contained in a typed array.
|
|
43
95
|
*/
|
|
44
|
-
|
|
96
|
+
enum TypedArrayType {
|
|
97
|
+
/**
|
|
98
|
+
* Not a typed array, or type unsupported.
|
|
99
|
+
*/
|
|
100
|
+
NONE,
|
|
101
|
+
/**
|
|
102
|
+
* Array elements are 8-bit signed integers (int8_t).
|
|
103
|
+
*/
|
|
104
|
+
INT8,
|
|
105
|
+
/**
|
|
106
|
+
* Array elements are 16-bit signed integers (int16_t).
|
|
107
|
+
*/
|
|
108
|
+
INT16,
|
|
109
|
+
/**
|
|
110
|
+
* Array elements are 32-bit signed integers (int32_t).
|
|
111
|
+
*/
|
|
112
|
+
INT32,
|
|
113
|
+
/**
|
|
114
|
+
* Array elements are 64-bit signed integers (int64_t).
|
|
115
|
+
*/
|
|
116
|
+
INT64,
|
|
117
|
+
/**
|
|
118
|
+
* Array elements are 8-bit unsigned integers (uint8_t).
|
|
119
|
+
*/
|
|
120
|
+
UINT8,
|
|
121
|
+
/**
|
|
122
|
+
* Array elements are 8-bit unsigned integers (uint8_t).
|
|
123
|
+
*/
|
|
124
|
+
UINT8_CLAMPED,
|
|
125
|
+
/**
|
|
126
|
+
* Array elements are 16-bit unsigned integers (uint16_t).
|
|
127
|
+
*/
|
|
128
|
+
UINT16,
|
|
129
|
+
/**
|
|
130
|
+
* Array elements are 32-bit unsigned integers (uint32_t).
|
|
131
|
+
*/
|
|
132
|
+
UINT32,
|
|
133
|
+
/**
|
|
134
|
+
* Array elements are 64-bit unsigned integers (uint64_t).
|
|
135
|
+
*/
|
|
136
|
+
UINT64,
|
|
137
|
+
/**
|
|
138
|
+
* Array elements are 32-bit floating point numbers (float).
|
|
139
|
+
*/
|
|
140
|
+
FLOAT32,
|
|
141
|
+
/**
|
|
142
|
+
* Array elements are 64-bit floating point numbers (double).
|
|
143
|
+
*/
|
|
144
|
+
FLOAT64,
|
|
145
|
+
}
|
|
45
146
|
/**
|
|
46
|
-
*
|
|
147
|
+
* Like jsc_get_major_version(), but from the headers used at
|
|
148
|
+
* application compile time, rather than from the library linked
|
|
149
|
+
* against at application run time.
|
|
47
150
|
*/
|
|
48
|
-
|
|
151
|
+
const MAJOR_VERSION: number;
|
|
49
152
|
/**
|
|
50
|
-
*
|
|
153
|
+
* Like jsc_get_micro_version(), but from the headers used at
|
|
154
|
+
* application compile time, rather than from the library linked
|
|
155
|
+
* against at application run time.
|
|
51
156
|
*/
|
|
52
|
-
|
|
157
|
+
const MICRO_VERSION: number;
|
|
53
158
|
/**
|
|
54
|
-
*
|
|
159
|
+
* Like jsc_get_minor_version(), but from the headers used at
|
|
160
|
+
* application compile time, rather than from the library linked
|
|
161
|
+
* against at application run time.
|
|
55
162
|
*/
|
|
56
|
-
|
|
163
|
+
const MINOR_VERSION: number;
|
|
57
164
|
/**
|
|
58
|
-
*
|
|
165
|
+
* Allows the DFG JIT to be used if %TRUE.
|
|
166
|
+
* Option type: %JSC_OPTION_BOOLEAN
|
|
167
|
+
* Default value: %TRUE.
|
|
59
168
|
*/
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Enum values for options types.
|
|
64
|
-
*/
|
|
65
|
-
enum OptionType {
|
|
169
|
+
const OPTIONS_USE_DFG: string;
|
|
66
170
|
/**
|
|
67
|
-
*
|
|
171
|
+
* Allows the FTL JIT to be used if %TRUE.
|
|
172
|
+
* Option type: %JSC_OPTION_BOOLEAN
|
|
173
|
+
* Default value: %TRUE.
|
|
68
174
|
*/
|
|
69
|
-
|
|
175
|
+
const OPTIONS_USE_FTL: string;
|
|
70
176
|
/**
|
|
71
|
-
*
|
|
177
|
+
* Allows the executable pages to be allocated for JIT and thunks if %TRUE.
|
|
178
|
+
* Option type: %JSC_OPTION_BOOLEAN
|
|
179
|
+
* Default value: %TRUE.
|
|
72
180
|
*/
|
|
73
|
-
|
|
181
|
+
const OPTIONS_USE_JIT: string;
|
|
74
182
|
/**
|
|
75
|
-
*
|
|
183
|
+
* Allows the LLINT to be used if %TRUE.
|
|
184
|
+
* Option type: %JSC_OPTION_BOOLEAN
|
|
185
|
+
* Default value: %TRUE.
|
|
76
186
|
*/
|
|
77
|
-
|
|
187
|
+
const OPTIONS_USE_LLINT: string;
|
|
78
188
|
/**
|
|
79
|
-
*
|
|
189
|
+
* Returns the major version number of the JavaScriptCore library.
|
|
190
|
+
* (e.g. in JavaScriptCore version 1.8.3 this is 1.)
|
|
191
|
+
*
|
|
192
|
+
* This function is in the library, so it represents the JavaScriptCore library
|
|
193
|
+
* your code is running against. Contrast with the #JSC_MAJOR_VERSION
|
|
194
|
+
* macro, which represents the major version of the JavaScriptCore headers you
|
|
195
|
+
* have included when compiling your code.
|
|
196
|
+
* @returns the major version number of the JavaScriptCore library
|
|
80
197
|
*/
|
|
81
|
-
|
|
198
|
+
function get_major_version(): number;
|
|
82
199
|
/**
|
|
83
|
-
*
|
|
200
|
+
* Returns the micro version number of the JavaScriptCore library.
|
|
201
|
+
* (e.g. in JavaScriptCore version 1.8.3 this is 3.)
|
|
202
|
+
*
|
|
203
|
+
* This function is in the library, so it represents the JavaScriptCore library
|
|
204
|
+
* your code is running against. Contrast with the #JSC_MICRO_VERSION
|
|
205
|
+
* macro, which represents the micro version of the JavaScriptCore headers you
|
|
206
|
+
* have included when compiling your code.
|
|
207
|
+
* @returns the micro version number of the JavaScriptCore library
|
|
84
208
|
*/
|
|
85
|
-
|
|
209
|
+
function get_micro_version(): number;
|
|
86
210
|
/**
|
|
87
|
-
*
|
|
211
|
+
* Returns the minor version number of the JavaScriptCore library.
|
|
212
|
+
* (e.g. in JavaScriptCore version 1.8.3 this is 8.)
|
|
213
|
+
*
|
|
214
|
+
* This function is in the library, so it represents the JavaScriptCore library
|
|
215
|
+
* your code is running against. Contrast with the #JSC_MINOR_VERSION
|
|
216
|
+
* macro, which represents the minor version of the JavaScriptCore headers you
|
|
217
|
+
* have included when compiling your code.
|
|
218
|
+
* @returns the minor version number of the JavaScriptCore library
|
|
88
219
|
*/
|
|
89
|
-
|
|
220
|
+
function get_minor_version(): number;
|
|
90
221
|
/**
|
|
91
|
-
*
|
|
222
|
+
* Iterates all available options calling `function` for each one. Iteration can
|
|
223
|
+
* stop early if `function` returns %FALSE.
|
|
224
|
+
* @param _function a #JSCOptionsFunc callback
|
|
92
225
|
*/
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Possible types of the elements contained in a typed array.
|
|
97
|
-
*/
|
|
98
|
-
enum TypedArrayType {
|
|
226
|
+
function options_foreach(_function: OptionsFunc): void;
|
|
99
227
|
/**
|
|
100
|
-
*
|
|
228
|
+
* Get `option` as a #gboolean value.
|
|
229
|
+
* @param option the option identifier
|
|
230
|
+
* @returns %TRUE if @value has been set or %FALSE if the option doesn't exist
|
|
101
231
|
*/
|
|
102
|
-
|
|
232
|
+
function options_get_boolean(option: string): [boolean, boolean];
|
|
103
233
|
/**
|
|
104
|
-
*
|
|
234
|
+
* Get `option` as a #gdouble value.
|
|
235
|
+
* @param option the option identifier
|
|
236
|
+
* @returns %TRUE if @value has been set or %FALSE if the option doesn't exist
|
|
105
237
|
*/
|
|
106
|
-
|
|
238
|
+
function options_get_double(option: string): [boolean, number];
|
|
107
239
|
/**
|
|
108
|
-
*
|
|
240
|
+
* Get `option` as a #gint value.
|
|
241
|
+
* @param option the option identifier
|
|
242
|
+
* @returns %TRUE if @value has been set or %FALSE if the option doesn't exist
|
|
109
243
|
*/
|
|
110
|
-
|
|
244
|
+
function options_get_int(option: string): [boolean, number];
|
|
111
245
|
/**
|
|
112
|
-
*
|
|
246
|
+
* Create a #GOptionGroup to handle JSCOptions as command line arguments.
|
|
247
|
+
* The options will be exposed as command line arguments with the form
|
|
248
|
+
* <emphasis>--jsc-<option>=<value></emphasis>.
|
|
249
|
+
* Each entry in the returned #GOptionGroup is configured to apply the
|
|
250
|
+
* corresponding option during command line parsing. Applications only need to
|
|
251
|
+
* pass the returned group to g_option_context_add_group(), and the rest will
|
|
252
|
+
* be taken care for automatically.
|
|
253
|
+
* @returns a #GOptionGroup for the JSCOptions
|
|
113
254
|
*/
|
|
114
|
-
|
|
255
|
+
function options_get_option_group(): GLib.OptionGroup;
|
|
115
256
|
/**
|
|
116
|
-
*
|
|
257
|
+
* Get `option` as a range string. The string must be in the
|
|
258
|
+
* format <emphasis>[!]<low>[:<high>]</emphasis> where low and high are #guint values.
|
|
259
|
+
* Values between low and high (both included) will be considered in
|
|
260
|
+
* the range, unless <emphasis>!</emphasis> is used to invert the range.
|
|
261
|
+
* @param option the option identifier
|
|
262
|
+
* @returns %TRUE if @value has been set or %FALSE if the option doesn't exist
|
|
117
263
|
*/
|
|
118
|
-
|
|
264
|
+
function options_get_range_string(option: string): [boolean, string];
|
|
119
265
|
/**
|
|
120
|
-
*
|
|
266
|
+
* Get `option` as a #gsize value.
|
|
267
|
+
* @param option the option identifier
|
|
268
|
+
* @returns %TRUE if @value has been set or %FALSE if the option doesn't exist
|
|
121
269
|
*/
|
|
122
|
-
|
|
270
|
+
function options_get_size(option: string): [boolean, number];
|
|
123
271
|
/**
|
|
124
|
-
*
|
|
272
|
+
* Get `option` as a string.
|
|
273
|
+
* @param option the option identifier
|
|
274
|
+
* @returns %TRUE if @value has been set or %FALSE if the option doesn't exist
|
|
125
275
|
*/
|
|
126
|
-
|
|
276
|
+
function options_get_string(option: string): [boolean, string];
|
|
127
277
|
/**
|
|
128
|
-
*
|
|
278
|
+
* Get `option` as a #guint value.
|
|
279
|
+
* @param option the option identifier
|
|
280
|
+
* @returns %TRUE if @value has been set or %FALSE if the option doesn't exist
|
|
129
281
|
*/
|
|
130
|
-
|
|
282
|
+
function options_get_uint(option: string): [boolean, number];
|
|
131
283
|
/**
|
|
132
|
-
*
|
|
284
|
+
* Set `option` as a #gboolean value.
|
|
285
|
+
* @param option the option identifier
|
|
286
|
+
* @param value the value to set
|
|
287
|
+
* @returns %TRUE if option was correctly set or %FALSE otherwise.
|
|
133
288
|
*/
|
|
134
|
-
|
|
289
|
+
function options_set_boolean(option: string, value: boolean): boolean;
|
|
135
290
|
/**
|
|
136
|
-
*
|
|
291
|
+
* Set `option` as a #gdouble value.
|
|
292
|
+
* @param option the option identifier
|
|
293
|
+
* @param value the value to set
|
|
294
|
+
* @returns %TRUE if option was correctly set or %FALSE otherwise.
|
|
137
295
|
*/
|
|
138
|
-
|
|
296
|
+
function options_set_double(option: string, value: number): boolean;
|
|
139
297
|
/**
|
|
140
|
-
*
|
|
298
|
+
* Set `option` as a #gint value.
|
|
299
|
+
* @param option the option identifier
|
|
300
|
+
* @param value the value to set
|
|
301
|
+
* @returns %TRUE if option was correctly set or %FALSE otherwise.
|
|
141
302
|
*/
|
|
142
|
-
|
|
303
|
+
function options_set_int(option: string, value: number): boolean;
|
|
143
304
|
/**
|
|
144
|
-
*
|
|
305
|
+
* Set `option` as a range string. The string must be in the
|
|
306
|
+
* format <emphasis>[!]<low>[:<high>]</emphasis> where low and high are #guint values.
|
|
307
|
+
* Values between low and high (both included) will be considered in
|
|
308
|
+
* the range, unless <emphasis>!</emphasis> is used to invert the range.
|
|
309
|
+
* @param option the option identifier
|
|
310
|
+
* @param value the value to set
|
|
311
|
+
* @returns %TRUE if option was correctly set or %FALSE otherwise.
|
|
145
312
|
*/
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Flags used when defining properties with jsc_value_object_define_property_data() and
|
|
150
|
-
* jsc_value_object_define_property_accessor().
|
|
151
|
-
* @bitfield
|
|
152
|
-
*/
|
|
153
|
-
enum ValuePropertyFlags {
|
|
313
|
+
function options_set_range_string(option: string, value: string): boolean;
|
|
154
314
|
/**
|
|
155
|
-
*
|
|
156
|
-
*
|
|
315
|
+
* Set `option` as a #gsize value.
|
|
316
|
+
* @param option the option identifier
|
|
317
|
+
* @param value the value to set
|
|
318
|
+
* @returns %TRUE if option was correctly set or %FALSE otherwise.
|
|
157
319
|
*/
|
|
158
|
-
|
|
320
|
+
function options_set_size(option: string, value: number): boolean;
|
|
159
321
|
/**
|
|
160
|
-
*
|
|
161
|
-
*
|
|
322
|
+
* Set `option` as a string.
|
|
323
|
+
* @param option the option identifier
|
|
324
|
+
* @param value the value to set
|
|
325
|
+
* @returns %TRUE if option was correctly set or %FALSE otherwise.
|
|
162
326
|
*/
|
|
163
|
-
|
|
327
|
+
function options_set_string(option: string, value: string): boolean;
|
|
164
328
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
329
|
+
* Set `option` as a #guint value.
|
|
330
|
+
* @param option the option identifier
|
|
331
|
+
* @param value the value to set
|
|
332
|
+
* @returns %TRUE if option was correctly set or %FALSE otherwise.
|
|
167
333
|
*/
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
* @returns the major version number of the JavaScriptCore library
|
|
221
|
-
*/
|
|
222
|
-
function get_major_version(): number
|
|
223
|
-
/**
|
|
224
|
-
* Returns the micro version number of the JavaScriptCore library.
|
|
225
|
-
* (e.g. in JavaScriptCore version 1.8.3 this is 3.)
|
|
226
|
-
*
|
|
227
|
-
* This function is in the library, so it represents the JavaScriptCore library
|
|
228
|
-
* your code is running against. Contrast with the #JSC_MICRO_VERSION
|
|
229
|
-
* macro, which represents the micro version of the JavaScriptCore headers you
|
|
230
|
-
* have included when compiling your code.
|
|
231
|
-
* @returns the micro version number of the JavaScriptCore library
|
|
232
|
-
*/
|
|
233
|
-
function get_micro_version(): number
|
|
234
|
-
/**
|
|
235
|
-
* Returns the minor version number of the JavaScriptCore library.
|
|
236
|
-
* (e.g. in JavaScriptCore version 1.8.3 this is 8.)
|
|
237
|
-
*
|
|
238
|
-
* This function is in the library, so it represents the JavaScriptCore library
|
|
239
|
-
* your code is running against. Contrast with the #JSC_MINOR_VERSION
|
|
240
|
-
* macro, which represents the minor version of the JavaScriptCore headers you
|
|
241
|
-
* have included when compiling your code.
|
|
242
|
-
* @returns the minor version number of the JavaScriptCore library
|
|
243
|
-
*/
|
|
244
|
-
function get_minor_version(): number
|
|
245
|
-
/**
|
|
246
|
-
* Iterates all available options calling `function` for each one. Iteration can
|
|
247
|
-
* stop early if `function` returns %FALSE.
|
|
248
|
-
* @param function_ a #JSCOptionsFunc callback
|
|
249
|
-
*/
|
|
250
|
-
function options_foreach(function_: OptionsFunc): void
|
|
251
|
-
/**
|
|
252
|
-
* Get `option` as a #gboolean value.
|
|
253
|
-
* @param option the option identifier
|
|
254
|
-
* @returns %TRUE if @value has been set or %FALSE if the option doesn't exist
|
|
255
|
-
*/
|
|
256
|
-
function options_get_boolean(option: string): [ /* returnType */ boolean, /* value */ boolean ]
|
|
257
|
-
/**
|
|
258
|
-
* Get `option` as a #gdouble value.
|
|
259
|
-
* @param option the option identifier
|
|
260
|
-
* @returns %TRUE if @value has been set or %FALSE if the option doesn't exist
|
|
261
|
-
*/
|
|
262
|
-
function options_get_double(option: string): [ /* returnType */ boolean, /* value */ number ]
|
|
263
|
-
/**
|
|
264
|
-
* Get `option` as a #gint value.
|
|
265
|
-
* @param option the option identifier
|
|
266
|
-
* @returns %TRUE if @value has been set or %FALSE if the option doesn't exist
|
|
267
|
-
*/
|
|
268
|
-
function options_get_int(option: string): [ /* returnType */ boolean, /* value */ number ]
|
|
269
|
-
/**
|
|
270
|
-
* Create a #GOptionGroup to handle JSCOptions as command line arguments.
|
|
271
|
-
* The options will be exposed as command line arguments with the form
|
|
272
|
-
* <emphasis>--jsc-<option>=<value></emphasis>.
|
|
273
|
-
* Each entry in the returned #GOptionGroup is configured to apply the
|
|
274
|
-
* corresponding option during command line parsing. Applications only need to
|
|
275
|
-
* pass the returned group to g_option_context_add_group(), and the rest will
|
|
276
|
-
* be taken care for automatically.
|
|
277
|
-
* @returns a #GOptionGroup for the JSCOptions
|
|
278
|
-
*/
|
|
279
|
-
function options_get_option_group(): GLib.OptionGroup
|
|
280
|
-
/**
|
|
281
|
-
* Get `option` as a range string. The string must be in the
|
|
282
|
-
* format <emphasis>[!]<low>[:<high>]</emphasis> where low and high are #guint values.
|
|
283
|
-
* Values between low and high (both included) will be considered in
|
|
284
|
-
* the range, unless <emphasis>!</emphasis> is used to invert the range.
|
|
285
|
-
* @param option the option identifier
|
|
286
|
-
* @returns %TRUE if @value has been set or %FALSE if the option doesn't exist
|
|
287
|
-
*/
|
|
288
|
-
function options_get_range_string(option: string): [ /* returnType */ boolean, /* value */ string | null ]
|
|
289
|
-
/**
|
|
290
|
-
* Get `option` as a #gsize value.
|
|
291
|
-
* @param option the option identifier
|
|
292
|
-
* @returns %TRUE if @value has been set or %FALSE if the option doesn't exist
|
|
293
|
-
*/
|
|
294
|
-
function options_get_size(option: string): [ /* returnType */ boolean, /* value */ number ]
|
|
295
|
-
/**
|
|
296
|
-
* Get `option` as a string.
|
|
297
|
-
* @param option the option identifier
|
|
298
|
-
* @returns %TRUE if @value has been set or %FALSE if the option doesn't exist
|
|
299
|
-
*/
|
|
300
|
-
function options_get_string(option: string): [ /* returnType */ boolean, /* value */ string | null ]
|
|
301
|
-
/**
|
|
302
|
-
* Get `option` as a #guint value.
|
|
303
|
-
* @param option the option identifier
|
|
304
|
-
* @returns %TRUE if @value has been set or %FALSE if the option doesn't exist
|
|
305
|
-
*/
|
|
306
|
-
function options_get_uint(option: string): [ /* returnType */ boolean, /* value */ number ]
|
|
307
|
-
/**
|
|
308
|
-
* Set `option` as a #gboolean value.
|
|
309
|
-
* @param option the option identifier
|
|
310
|
-
* @param value the value to set
|
|
311
|
-
* @returns %TRUE if option was correctly set or %FALSE otherwise.
|
|
312
|
-
*/
|
|
313
|
-
function options_set_boolean(option: string, value: boolean): boolean
|
|
314
|
-
/**
|
|
315
|
-
* Set `option` as a #gdouble value.
|
|
316
|
-
* @param option the option identifier
|
|
317
|
-
* @param value the value to set
|
|
318
|
-
* @returns %TRUE if option was correctly set or %FALSE otherwise.
|
|
319
|
-
*/
|
|
320
|
-
function options_set_double(option: string, value: number): boolean
|
|
321
|
-
/**
|
|
322
|
-
* Set `option` as a #gint value.
|
|
323
|
-
* @param option the option identifier
|
|
324
|
-
* @param value the value to set
|
|
325
|
-
* @returns %TRUE if option was correctly set or %FALSE otherwise.
|
|
326
|
-
*/
|
|
327
|
-
function options_set_int(option: string, value: number): boolean
|
|
328
|
-
/**
|
|
329
|
-
* Set `option` as a range string. The string must be in the
|
|
330
|
-
* format <emphasis>[!]<low>[:<high>]</emphasis> where low and high are #guint values.
|
|
331
|
-
* Values between low and high (both included) will be considered in
|
|
332
|
-
* the range, unless <emphasis>!</emphasis> is used to invert the range.
|
|
333
|
-
* @param option the option identifier
|
|
334
|
-
* @param value the value to set
|
|
335
|
-
* @returns %TRUE if option was correctly set or %FALSE otherwise.
|
|
336
|
-
*/
|
|
337
|
-
function options_set_range_string(option: string, value: string): boolean
|
|
338
|
-
/**
|
|
339
|
-
* Set `option` as a #gsize value.
|
|
340
|
-
* @param option the option identifier
|
|
341
|
-
* @param value the value to set
|
|
342
|
-
* @returns %TRUE if option was correctly set or %FALSE otherwise.
|
|
343
|
-
*/
|
|
344
|
-
function options_set_size(option: string, value: number): boolean
|
|
345
|
-
/**
|
|
346
|
-
* Set `option` as a string.
|
|
347
|
-
* @param option the option identifier
|
|
348
|
-
* @param value the value to set
|
|
349
|
-
* @returns %TRUE if option was correctly set or %FALSE otherwise.
|
|
350
|
-
*/
|
|
351
|
-
function options_set_string(option: string, value: string): boolean
|
|
352
|
-
/**
|
|
353
|
-
* Set `option` as a #guint value.
|
|
354
|
-
* @param option the option identifier
|
|
355
|
-
* @param value the value to set
|
|
356
|
-
* @returns %TRUE if option was correctly set or %FALSE otherwise.
|
|
357
|
-
*/
|
|
358
|
-
function options_set_uint(option: string, value: number): boolean
|
|
359
|
-
/**
|
|
360
|
-
* The type of delete_property in #JSCClassVTable. This is only required when you need to handle
|
|
361
|
-
* external properties not added to the prototype.
|
|
362
|
-
* @callback
|
|
363
|
-
* @param jsc_class a #JSCClass
|
|
364
|
-
* @param context a #JSCContext
|
|
365
|
-
* @param instance the `jsc_class` instance
|
|
366
|
-
* @param name the property name
|
|
367
|
-
* @returns %TRUE if handled or %FALSE to to forward the request to the parent class or prototype chain.
|
|
368
|
-
*/
|
|
369
|
-
interface ClassDeletePropertyFunction {
|
|
370
|
-
(jsc_class: Class, context: Context, instance: any | null, name: string): boolean
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* The type of enumerate_properties in #JSCClassVTable. This is only required when you need to handle
|
|
374
|
-
* external properties not added to the prototype.
|
|
375
|
-
* @callback
|
|
376
|
-
* @param jsc_class a #JSCClass
|
|
377
|
-
* @param context a #JSCContext
|
|
378
|
-
* @param instance the `jsc_class` instance
|
|
379
|
-
* @returns a %NULL-terminated array of strings containing the property names, or %NULL if @instance doesn't have enumerable properties.
|
|
380
|
-
*/
|
|
381
|
-
interface ClassEnumeratePropertiesFunction {
|
|
382
|
-
(jsc_class: Class, context: Context, instance: any | null): string[] | null
|
|
383
|
-
}
|
|
384
|
-
/**
|
|
385
|
-
* The type of get_property in #JSCClassVTable. This is only required when you need to handle
|
|
386
|
-
* external properties not added to the prototype.
|
|
387
|
-
* @callback
|
|
388
|
-
* @param jsc_class a #JSCClass
|
|
389
|
-
* @param context a #JSCContext
|
|
390
|
-
* @param instance the `jsc_class` instance
|
|
391
|
-
* @param name the property name
|
|
392
|
-
* @returns a #JSCValue or %NULL to forward the request to the parent class or prototype chain
|
|
393
|
-
*/
|
|
394
|
-
interface ClassGetPropertyFunction {
|
|
395
|
-
(jsc_class: Class, context: Context, instance: any | null, name: string): Value | null
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* The type of has_property in #JSCClassVTable. This is only required when you need to handle
|
|
399
|
-
* external properties not added to the prototype.
|
|
400
|
-
* @callback
|
|
401
|
-
* @param jsc_class a #JSCClass
|
|
402
|
-
* @param context a #JSCContext
|
|
403
|
-
* @param instance the `jsc_class` instance
|
|
404
|
-
* @param name the property name
|
|
405
|
-
* @returns %TRUE if @instance has a property with @name or %FALSE to forward the request to the parent class or prototype chain.
|
|
406
|
-
*/
|
|
407
|
-
interface ClassHasPropertyFunction {
|
|
408
|
-
(jsc_class: Class, context: Context, instance: any | null, name: string): boolean
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* The type of set_property in #JSCClassVTable. This is only required when you need to handle
|
|
412
|
-
* external properties not added to the prototype.
|
|
413
|
-
* @callback
|
|
414
|
-
* @param jsc_class a #JSCClass
|
|
415
|
-
* @param context a #JSCContext
|
|
416
|
-
* @param instance the `jsc_class` instance
|
|
417
|
-
* @param name the property name
|
|
418
|
-
* @param value the #JSCValue to set
|
|
419
|
-
* @returns %TRUE if handled or %FALSE to forward the request to the parent class or prototype chain.
|
|
420
|
-
*/
|
|
421
|
-
interface ClassSetPropertyFunction {
|
|
422
|
-
(jsc_class: Class, context: Context, instance: any | null, name: string, value: Value): boolean
|
|
423
|
-
}
|
|
424
|
-
/**
|
|
425
|
-
* Function used to handle JavaScript exceptions in a #JSCContext.
|
|
426
|
-
* @callback
|
|
427
|
-
* @param context a #JSCContext
|
|
428
|
-
* @param exception a #JSCException
|
|
429
|
-
*/
|
|
430
|
-
interface ExceptionHandler {
|
|
431
|
-
(context: Context, exception: Exception): void
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
* Function used to iterate options.
|
|
435
|
-
*
|
|
436
|
-
* Not that `description` string is not localized.
|
|
437
|
-
* @callback
|
|
438
|
-
* @param option the option name
|
|
439
|
-
* @param type the option #JSCOptionType
|
|
440
|
-
* @param description the option description, or %NULL
|
|
441
|
-
* @returns %TRUE to stop the iteration, or %FALSE otherwise
|
|
442
|
-
*/
|
|
443
|
-
interface OptionsFunc {
|
|
444
|
-
(option: string, type: OptionType, description: string | null): boolean
|
|
445
|
-
}
|
|
446
|
-
module Class {
|
|
447
|
-
|
|
448
|
-
// Constructor properties interface
|
|
334
|
+
function options_set_uint(option: string, value: number): boolean;
|
|
335
|
+
interface ClassDeletePropertyFunction {
|
|
336
|
+
(jsc_class: Class, context: Context, instance: any | null, name: string): boolean;
|
|
337
|
+
}
|
|
338
|
+
interface ClassEnumeratePropertiesFunction {
|
|
339
|
+
(jsc_class: Class, context: Context, instance?: any | null): string[] | null;
|
|
340
|
+
}
|
|
341
|
+
interface ClassGetPropertyFunction {
|
|
342
|
+
(jsc_class: Class, context: Context, instance: any | null, name: string): Value | null;
|
|
343
|
+
}
|
|
344
|
+
interface ClassHasPropertyFunction {
|
|
345
|
+
(jsc_class: Class, context: Context, instance: any | null, name: string): boolean;
|
|
346
|
+
}
|
|
347
|
+
interface ClassSetPropertyFunction {
|
|
348
|
+
(jsc_class: Class, context: Context, instance: any | null, name: string, value: Value): boolean;
|
|
349
|
+
}
|
|
350
|
+
interface ExceptionHandler {
|
|
351
|
+
(context: Context, exception: Exception): void;
|
|
352
|
+
}
|
|
353
|
+
interface OptionsFunc {
|
|
354
|
+
(option: string, type: OptionType, description?: string | null): boolean;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Flags used when defining properties with jsc_value_object_define_property_data() and
|
|
358
|
+
* jsc_value_object_define_property_accessor().
|
|
359
|
+
*/
|
|
360
|
+
enum ValuePropertyFlags {
|
|
361
|
+
/**
|
|
362
|
+
* the type of the property descriptor may be changed and the
|
|
363
|
+
* property may be deleted from the corresponding object.
|
|
364
|
+
*/
|
|
365
|
+
CONFIGURABLE,
|
|
366
|
+
/**
|
|
367
|
+
* the property shows up during enumeration of the properties on
|
|
368
|
+
* the corresponding object.
|
|
369
|
+
*/
|
|
370
|
+
ENUMERABLE,
|
|
371
|
+
/**
|
|
372
|
+
* the value associated with the property may be changed with an
|
|
373
|
+
* assignment operator. This doesn't have any effect when passed to jsc_value_object_define_property_accessor().
|
|
374
|
+
*/
|
|
375
|
+
WRITABLE,
|
|
376
|
+
}
|
|
377
|
+
module Class {
|
|
378
|
+
// Constructor properties interface
|
|
379
|
+
|
|
380
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {
|
|
381
|
+
context: Context;
|
|
382
|
+
name: string;
|
|
383
|
+
parent: Class;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
449
386
|
|
|
450
|
-
|
|
387
|
+
/**
|
|
388
|
+
* A JSSClass represents a custom JavaScript class registered by the user in a #JSCContext.
|
|
389
|
+
* It allows to create new JavaScripts objects whose instances are created by the user using
|
|
390
|
+
* this API.
|
|
391
|
+
* It's possible to add constructors, properties and methods for a JSSClass by providing
|
|
392
|
+
* #GCallback<!-- -->s to implement them.
|
|
393
|
+
*/
|
|
394
|
+
class Class extends GObject.Object {
|
|
395
|
+
static $gtype: GObject.GType<Class>;
|
|
451
396
|
|
|
452
|
-
// Own
|
|
397
|
+
// Own properties of JavaScriptCore.Class
|
|
453
398
|
|
|
454
399
|
/**
|
|
455
400
|
* The #JSCContext in which the class was registered.
|
|
456
401
|
*/
|
|
457
|
-
context
|
|
402
|
+
set context(val: Context);
|
|
458
403
|
/**
|
|
459
404
|
* The name of the class.
|
|
460
405
|
*/
|
|
461
|
-
name
|
|
406
|
+
get name(): string;
|
|
462
407
|
/**
|
|
463
408
|
* The parent class or %NULL in case of final classes.
|
|
464
409
|
*/
|
|
465
|
-
parent
|
|
466
|
-
}
|
|
410
|
+
get parent(): Class;
|
|
467
411
|
|
|
468
|
-
|
|
412
|
+
// Constructors of JavaScriptCore.Class
|
|
469
413
|
|
|
470
|
-
|
|
414
|
+
constructor(properties?: Partial<Class.ConstructorProps>, ...args: any[]);
|
|
471
415
|
|
|
472
|
-
|
|
416
|
+
_init(...args: any[]): void;
|
|
473
417
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
418
|
+
// Own methods of JavaScriptCore.Class
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Add a constructor to `jsc_class`. If `name` is %NULL, the class name will be used. When <function>new</function>
|
|
422
|
+
* is used with the constructor or jsc_value_constructor_call() is called, `callback` is invoked receiving
|
|
423
|
+
* a #GPtrArray of #JSCValue<!-- -->s as arguments and `user_data` as the last parameter. When the constructor object
|
|
424
|
+
* is cleared in the #JSCClass context, `destroy_notify` is called with `user_data` as parameter.
|
|
425
|
+
*
|
|
426
|
+
* This function creates the constructor, which needs to be added to an object as a property to be able to use it. Use
|
|
427
|
+
* jsc_context_set_value() to make the constructor available in the global object.
|
|
428
|
+
*
|
|
429
|
+
* Note that the value returned by `callback` is adopted by `jsc_class,` and the #GDestroyNotify passed to
|
|
430
|
+
* jsc_context_register_class() is responsible for disposing of it.
|
|
431
|
+
* @param name the constructor name or %NULL
|
|
432
|
+
* @param callback a #GCallback to be called to create an instance of @jsc_class
|
|
433
|
+
* @param destroy_notify destroy notifier for @user_data
|
|
434
|
+
* @param return_type the #GType of the constructor return value
|
|
435
|
+
* @returns a #JSCValue representing the class constructor.
|
|
436
|
+
*/
|
|
437
|
+
add_constructor_variadic(
|
|
438
|
+
name: string | null,
|
|
439
|
+
callback: GObject.Callback,
|
|
440
|
+
destroy_notify: GLib.DestroyNotify | null,
|
|
441
|
+
return_type: GObject.GType,
|
|
442
|
+
): Value;
|
|
443
|
+
/**
|
|
444
|
+
* Add a constructor to `jsc_class`. If `name` is %NULL, the class name will be used. When <function>new</function>
|
|
445
|
+
* is used with the constructor or jsc_value_constructor_call() is called, `callback` is invoked receiving the
|
|
446
|
+
* parameters and `user_data` as the last parameter. When the constructor object is cleared in the #JSCClass context,
|
|
447
|
+
* `destroy_notify` is called with `user_data` as parameter.
|
|
448
|
+
*
|
|
449
|
+
* This function creates the constructor, which needs to be added to an object as a property to be able to use it. Use
|
|
450
|
+
* jsc_context_set_value() to make the constructor available in the global object.
|
|
451
|
+
*
|
|
452
|
+
* Note that the value returned by `callback` is adopted by `jsc_class,` and the #GDestroyNotify passed to
|
|
453
|
+
* jsc_context_register_class() is responsible for disposing of it.
|
|
454
|
+
* @param name the constructor name or %NULL
|
|
455
|
+
* @param callback a #GCallback to be called to create an instance of @jsc_class
|
|
456
|
+
* @param destroy_notify destroy notifier for @user_data
|
|
457
|
+
* @param return_type the #GType of the constructor return value
|
|
458
|
+
* @param parameter_types a list of #GType<!-- -->s, one for each parameter, or %NULL
|
|
459
|
+
* @returns a #JSCValue representing the class constructor.
|
|
460
|
+
*/
|
|
461
|
+
add_constructor(
|
|
462
|
+
name: string | null,
|
|
463
|
+
callback: GObject.Callback,
|
|
464
|
+
destroy_notify: GLib.DestroyNotify | null,
|
|
465
|
+
return_type: GObject.GType,
|
|
466
|
+
parameter_types?: GObject.GType[] | null,
|
|
467
|
+
): Value;
|
|
468
|
+
/**
|
|
469
|
+
* Add method with `name` to `jsc_class`. When the method is called by JavaScript or jsc_value_object_invoke_method(),
|
|
470
|
+
* `callback` is called receiving the class instance as first parameter, followed by a #GPtrArray of #JSCValue<!-- -->s
|
|
471
|
+
* with the method arguments and then `user_data` as last parameter. When the method is cleared in the #JSCClass context,
|
|
472
|
+
* `destroy_notify` is called with `user_data` as parameter.
|
|
473
|
+
*
|
|
474
|
+
* Note that the value returned by `callback` must be transfer full. In case of non-refcounted boxed types, you should use
|
|
475
|
+
* %G_TYPE_POINTER instead of the actual boxed #GType to ensure that the instance owned by #JSCClass is used.
|
|
476
|
+
* If you really want to return a new copy of the boxed type, use #JSC_TYPE_VALUE and return a #JSCValue created
|
|
477
|
+
* with jsc_value_new_object() that receives the copy as the instance parameter.
|
|
478
|
+
* @param name the method name
|
|
479
|
+
* @param callback a #GCallback to be called to invoke method @name of @jsc_class
|
|
480
|
+
* @param destroy_notify destroy notifier for @user_data
|
|
481
|
+
* @param return_type the #GType of the method return value, or %G_TYPE_NONE if the method is void.
|
|
482
|
+
*/
|
|
483
|
+
add_method_variadic(
|
|
484
|
+
name: string,
|
|
485
|
+
callback: GObject.Callback,
|
|
486
|
+
destroy_notify: GLib.DestroyNotify | null,
|
|
487
|
+
return_type: GObject.GType,
|
|
488
|
+
): void;
|
|
489
|
+
/**
|
|
490
|
+
* Add method with `name` to `jsc_class`. When the method is called by JavaScript or jsc_value_object_invoke_method(),
|
|
491
|
+
* `callback` is called receiving the class instance as first parameter, followed by the method parameters and then
|
|
492
|
+
* `user_data` as last parameter. When the method is cleared in the #JSCClass context, `destroy_notify` is called with
|
|
493
|
+
* `user_data` as parameter.
|
|
494
|
+
*
|
|
495
|
+
* Note that the value returned by `callback` must be transfer full. In case of non-refcounted boxed types, you should use
|
|
496
|
+
* %G_TYPE_POINTER instead of the actual boxed #GType to ensure that the instance owned by #JSCClass is used.
|
|
497
|
+
* If you really want to return a new copy of the boxed type, use #JSC_TYPE_VALUE and return a #JSCValue created
|
|
498
|
+
* with jsc_value_new_object() that receives the copy as the instance parameter.
|
|
499
|
+
* @param name the method name
|
|
500
|
+
* @param callback a #GCallback to be called to invoke method @name of @jsc_class
|
|
501
|
+
* @param destroy_notify destroy notifier for @user_data
|
|
502
|
+
* @param return_type the #GType of the method return value, or %G_TYPE_NONE if the method is void.
|
|
503
|
+
* @param parameter_types a list of #GType<!-- -->s, one for each parameter, or %NULL
|
|
504
|
+
*/
|
|
505
|
+
add_method(
|
|
506
|
+
name: string,
|
|
507
|
+
callback: GObject.Callback,
|
|
508
|
+
destroy_notify: GLib.DestroyNotify | null,
|
|
509
|
+
return_type: GObject.GType,
|
|
510
|
+
parameter_types?: GObject.GType[] | null,
|
|
511
|
+
): void;
|
|
512
|
+
/**
|
|
513
|
+
* Add a property with `name` to `jsc_class`. When the property value needs to be getted, `getter` is called
|
|
514
|
+
* receiving the the class instance as first parameter and `user_data` as last parameter. When the property
|
|
515
|
+
* value needs to be set, `setter` is called receiving the the class instance as first parameter, followed
|
|
516
|
+
* by the value to be set and then `user_data` as the last parameter. When the property is cleared in the
|
|
517
|
+
* #JSCClass context, `destroy_notify` is called with `user_data` as parameter.
|
|
518
|
+
*
|
|
519
|
+
* Note that the value returned by `getter` must be transfer full. In case of non-refcounted boxed types, you should use
|
|
520
|
+
* %G_TYPE_POINTER instead of the actual boxed #GType to ensure that the instance owned by #JSCClass is used.
|
|
521
|
+
* If you really want to return a new copy of the boxed type, use #JSC_TYPE_VALUE and return a #JSCValue created
|
|
522
|
+
* with jsc_value_new_object() that receives the copy as the instance parameter.
|
|
523
|
+
* @param name the property name
|
|
524
|
+
* @param property_type the #GType of the property value
|
|
525
|
+
* @param getter a #GCallback to be called to get the property value
|
|
526
|
+
* @param setter a #GCallback to be called to set the property value
|
|
527
|
+
* @param destroy_notify destroy notifier for @user_data
|
|
528
|
+
*/
|
|
529
|
+
add_property(
|
|
530
|
+
name: string,
|
|
531
|
+
property_type: GObject.GType,
|
|
532
|
+
getter?: GObject.Callback | null,
|
|
533
|
+
setter?: GObject.Callback | null,
|
|
534
|
+
destroy_notify?: GLib.DestroyNotify | null,
|
|
535
|
+
): void;
|
|
536
|
+
/**
|
|
537
|
+
* Get the class name of `jsc_class`
|
|
538
|
+
* @returns the name of @jsc_class
|
|
539
|
+
*/
|
|
540
|
+
get_name(): string;
|
|
541
|
+
/**
|
|
542
|
+
* Get the parent class of `jsc_class`
|
|
543
|
+
* @returns the parent class of @jsc_class
|
|
544
|
+
*/
|
|
545
|
+
get_parent(): Class;
|
|
546
|
+
}
|
|
486
547
|
|
|
487
|
-
|
|
548
|
+
module Context {
|
|
549
|
+
// Constructor properties interface
|
|
550
|
+
|
|
551
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {
|
|
552
|
+
virtual_machine: VirtualMachine;
|
|
553
|
+
virtualMachine: VirtualMachine;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
488
556
|
|
|
489
557
|
/**
|
|
490
|
-
*
|
|
491
|
-
*
|
|
492
|
-
*
|
|
493
|
-
*
|
|
494
|
-
*
|
|
495
|
-
*
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
* Note that the value returned by `callback` is adopted by `jsc_class,` and the #GDestroyNotify passed to
|
|
499
|
-
* jsc_context_register_class() is responsible for disposing of it.
|
|
500
|
-
* @param name the constructor name or %NULL
|
|
501
|
-
* @param callback a #GCallback to be called to create an instance of `jsc_class`
|
|
502
|
-
* @param return_type the #GType of the constructor return value
|
|
503
|
-
* @returns a #JSCValue representing the class constructor.
|
|
504
|
-
*/
|
|
505
|
-
add_constructor_variadic(name: string | null, callback: GObject.Callback, return_type: GObject.GType): Value
|
|
506
|
-
/**
|
|
507
|
-
* Add a constructor to `jsc_class`. If `name` is %NULL, the class name will be used. When <function>new</function>
|
|
508
|
-
* is used with the constructor or jsc_value_constructor_call() is called, `callback` is invoked receiving the
|
|
509
|
-
* parameters and `user_data` as the last parameter. When the constructor object is cleared in the #JSCClass context,
|
|
510
|
-
* `destroy_notify` is called with `user_data` as parameter.
|
|
511
|
-
*
|
|
512
|
-
* This function creates the constructor, which needs to be added to an object as a property to be able to use it. Use
|
|
513
|
-
* jsc_context_set_value() to make the constructor available in the global object.
|
|
514
|
-
*
|
|
515
|
-
* Note that the value returned by `callback` is adopted by `jsc_class,` and the #GDestroyNotify passed to
|
|
516
|
-
* jsc_context_register_class() is responsible for disposing of it.
|
|
517
|
-
* @param name the constructor name or %NULL
|
|
518
|
-
* @param callback a #GCallback to be called to create an instance of `jsc_class`
|
|
519
|
-
* @param return_type the #GType of the constructor return value
|
|
520
|
-
* @param parameter_types a list of #GType<!-- -->s, one for each parameter, or %NULL
|
|
521
|
-
* @returns a #JSCValue representing the class constructor.
|
|
522
|
-
*/
|
|
523
|
-
add_constructor(name: string | null, callback: GObject.Callback, return_type: GObject.GType, parameter_types: GObject.GType[] | null): Value
|
|
524
|
-
/**
|
|
525
|
-
* Add method with `name` to `jsc_class`. When the method is called by JavaScript or jsc_value_object_invoke_method(),
|
|
526
|
-
* `callback` is called receiving the class instance as first parameter, followed by a #GPtrArray of #JSCValue<!-- -->s
|
|
527
|
-
* with the method arguments and then `user_data` as last parameter. When the method is cleared in the #JSCClass context,
|
|
528
|
-
* `destroy_notify` is called with `user_data` as parameter.
|
|
529
|
-
*
|
|
530
|
-
* Note that the value returned by `callback` must be transfer full. In case of non-refcounted boxed types, you should use
|
|
531
|
-
* %G_TYPE_POINTER instead of the actual boxed #GType to ensure that the instance owned by #JSCClass is used.
|
|
532
|
-
* If you really want to return a new copy of the boxed type, use #JSC_TYPE_VALUE and return a #JSCValue created
|
|
533
|
-
* with jsc_value_new_object() that receives the copy as the instance parameter.
|
|
534
|
-
* @param name the method name
|
|
535
|
-
* @param callback a #GCallback to be called to invoke method `name` of `jsc_class`
|
|
536
|
-
* @param return_type the #GType of the method return value, or %G_TYPE_NONE if the method is void.
|
|
537
|
-
*/
|
|
538
|
-
add_method_variadic(name: string, callback: GObject.Callback, return_type: GObject.GType): void
|
|
539
|
-
/**
|
|
540
|
-
* Add method with `name` to `jsc_class`. When the method is called by JavaScript or jsc_value_object_invoke_method(),
|
|
541
|
-
* `callback` is called receiving the class instance as first parameter, followed by the method parameters and then
|
|
542
|
-
* `user_data` as last parameter. When the method is cleared in the #JSCClass context, `destroy_notify` is called with
|
|
543
|
-
* `user_data` as parameter.
|
|
544
|
-
*
|
|
545
|
-
* Note that the value returned by `callback` must be transfer full. In case of non-refcounted boxed types, you should use
|
|
546
|
-
* %G_TYPE_POINTER instead of the actual boxed #GType to ensure that the instance owned by #JSCClass is used.
|
|
547
|
-
* If you really want to return a new copy of the boxed type, use #JSC_TYPE_VALUE and return a #JSCValue created
|
|
548
|
-
* with jsc_value_new_object() that receives the copy as the instance parameter.
|
|
549
|
-
* @param name the method name
|
|
550
|
-
* @param callback a #GCallback to be called to invoke method `name` of `jsc_class`
|
|
551
|
-
* @param return_type the #GType of the method return value, or %G_TYPE_NONE if the method is void.
|
|
552
|
-
* @param parameter_types a list of #GType<!-- -->s, one for each parameter, or %NULL
|
|
553
|
-
*/
|
|
554
|
-
add_method(name: string, callback: GObject.Callback, return_type: GObject.GType, parameter_types: GObject.GType[] | null): void
|
|
555
|
-
/**
|
|
556
|
-
* Add a property with `name` to `jsc_class`. When the property value needs to be getted, `getter` is called
|
|
557
|
-
* receiving the the class instance as first parameter and `user_data` as last parameter. When the property
|
|
558
|
-
* value needs to be set, `setter` is called receiving the the class instance as first parameter, followed
|
|
559
|
-
* by the value to be set and then `user_data` as the last parameter. When the property is cleared in the
|
|
560
|
-
* #JSCClass context, `destroy_notify` is called with `user_data` as parameter.
|
|
561
|
-
*
|
|
562
|
-
* Note that the value returned by `getter` must be transfer full. In case of non-refcounted boxed types, you should use
|
|
563
|
-
* %G_TYPE_POINTER instead of the actual boxed #GType to ensure that the instance owned by #JSCClass is used.
|
|
564
|
-
* If you really want to return a new copy of the boxed type, use #JSC_TYPE_VALUE and return a #JSCValue created
|
|
565
|
-
* with jsc_value_new_object() that receives the copy as the instance parameter.
|
|
566
|
-
* @param name the property name
|
|
567
|
-
* @param property_type the #GType of the property value
|
|
568
|
-
* @param getter a #GCallback to be called to get the property value
|
|
569
|
-
* @param setter a #GCallback to be called to set the property value
|
|
570
|
-
*/
|
|
571
|
-
add_property(name: string, property_type: GObject.GType, getter: GObject.Callback | null, setter: GObject.Callback | null): void
|
|
572
|
-
/**
|
|
573
|
-
* Get the class name of `jsc_class`
|
|
574
|
-
* @returns the name of @jsc_class
|
|
575
|
-
*/
|
|
576
|
-
get_name(): string
|
|
577
|
-
/**
|
|
578
|
-
* Get the parent class of `jsc_class`
|
|
579
|
-
* @returns the parent class of @jsc_class
|
|
558
|
+
* JSCContext represents a JavaScript execution context, where all operations
|
|
559
|
+
* take place and where the values will be associated.
|
|
560
|
+
*
|
|
561
|
+
* When a new context is created, a global object is allocated and the built-in JavaScript
|
|
562
|
+
* objects (Object, Function, String, Array) are populated. You can execute JavaScript in
|
|
563
|
+
* the context by using jsc_context_evaluate() or jsc_context_evaluate_with_source_uri().
|
|
564
|
+
* It's also possible to register custom objects in the context with jsc_context_register_class().
|
|
580
565
|
*/
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
// Class property signals of JavaScriptCore-6.0.JavaScriptCore.Class
|
|
584
|
-
|
|
585
|
-
connect(sigName: "notify::context", callback: (($obj: Class, pspec: GObject.ParamSpec) => void)): number
|
|
586
|
-
connect_after(sigName: "notify::context", callback: (($obj: Class, pspec: GObject.ParamSpec) => void)): number
|
|
587
|
-
emit(sigName: "notify::context", ...args: any[]): void
|
|
588
|
-
connect(sigName: "notify::name", callback: (($obj: Class, pspec: GObject.ParamSpec) => void)): number
|
|
589
|
-
connect_after(sigName: "notify::name", callback: (($obj: Class, pspec: GObject.ParamSpec) => void)): number
|
|
590
|
-
emit(sigName: "notify::name", ...args: any[]): void
|
|
591
|
-
connect(sigName: "notify::parent", callback: (($obj: Class, pspec: GObject.ParamSpec) => void)): number
|
|
592
|
-
connect_after(sigName: "notify::parent", callback: (($obj: Class, pspec: GObject.ParamSpec) => void)): number
|
|
593
|
-
emit(sigName: "notify::parent", ...args: any[]): void
|
|
594
|
-
connect(sigName: string, callback: (...args: any[]) => void): number
|
|
595
|
-
connect_after(sigName: string, callback: (...args: any[]) => void): number
|
|
596
|
-
emit(sigName: string, ...args: any[]): void
|
|
597
|
-
disconnect(id: number): void
|
|
598
|
-
}
|
|
566
|
+
class Context extends GObject.Object {
|
|
567
|
+
static $gtype: GObject.GType<Context>;
|
|
599
568
|
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
569
|
+
// Own properties of JavaScriptCore.Context
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* The #JSCVirtualMachine in which the context was created.
|
|
573
|
+
*/
|
|
574
|
+
get virtual_machine(): VirtualMachine;
|
|
575
|
+
/**
|
|
576
|
+
* The #JSCVirtualMachine in which the context was created.
|
|
577
|
+
*/
|
|
578
|
+
get virtualMachine(): VirtualMachine;
|
|
609
579
|
|
|
610
|
-
|
|
580
|
+
// Constructors of JavaScriptCore.Context
|
|
611
581
|
|
|
612
|
-
|
|
613
|
-
static $gtype: GObject.GType<Class>
|
|
582
|
+
constructor(properties?: Partial<Context.ConstructorProps>, ...args: any[]);
|
|
614
583
|
|
|
615
|
-
|
|
584
|
+
_init(...args: any[]): void;
|
|
616
585
|
|
|
617
|
-
|
|
618
|
-
_init(config?: Class.ConstructorProperties): void
|
|
619
|
-
}
|
|
586
|
+
static ['new'](): Context;
|
|
620
587
|
|
|
621
|
-
|
|
588
|
+
static new_with_virtual_machine(vm: VirtualMachine): Context;
|
|
622
589
|
|
|
623
|
-
|
|
590
|
+
// Own static methods of JavaScriptCore.Context
|
|
624
591
|
|
|
625
|
-
|
|
592
|
+
/**
|
|
593
|
+
* Get the #JSCContext that is currently executing a function. This should only be
|
|
594
|
+
* called within a function or method callback, otherwise %NULL will be returned.
|
|
595
|
+
*/
|
|
596
|
+
static get_current(): Context | null;
|
|
626
597
|
|
|
627
|
-
// Own
|
|
598
|
+
// Own methods of JavaScriptCore.Context
|
|
628
599
|
|
|
629
600
|
/**
|
|
630
|
-
*
|
|
601
|
+
* Check the given `code` in `context` for syntax errors. The `line_number` is the starting line number in `uri;`
|
|
602
|
+
* the value is one-based so the first line is 1. `uri` and `line_number` are only used to fill the `exception`.
|
|
603
|
+
* In case of errors `exception` will be set to a new #JSCException with the details. You can pass %NULL to
|
|
604
|
+
* `exception` to ignore the error details.
|
|
605
|
+
* @param code a JavaScript script to check
|
|
606
|
+
* @param length length of @code, or -1 if @code is a nul-terminated string
|
|
607
|
+
* @param mode a #JSCCheckSyntaxMode
|
|
608
|
+
* @param uri the source URI
|
|
609
|
+
* @param line_number the starting line number
|
|
610
|
+
* @returns a #JSCCheckSyntaxResult
|
|
611
|
+
*/
|
|
612
|
+
check_syntax(
|
|
613
|
+
code: string,
|
|
614
|
+
length: number,
|
|
615
|
+
mode: CheckSyntaxMode,
|
|
616
|
+
uri: string,
|
|
617
|
+
line_number: number,
|
|
618
|
+
): [CheckSyntaxResult, Exception | null];
|
|
619
|
+
/**
|
|
620
|
+
* Clear the uncaught exception in `context` if any.
|
|
621
|
+
*/
|
|
622
|
+
clear_exception(): void;
|
|
623
|
+
/**
|
|
624
|
+
* Evaluate `code` in `context`.
|
|
625
|
+
* @param code a JavaScript script to evaluate
|
|
626
|
+
* @param length length of @code, or -1 if @code is a nul-terminated string
|
|
627
|
+
* @returns a #JSCValue representing the last value generated by the script.
|
|
628
|
+
*/
|
|
629
|
+
evaluate(code: string, length: number): Value;
|
|
630
|
+
/**
|
|
631
|
+
* Evaluate `code` and create an new object where symbols defined in `code` will be added as properties,
|
|
632
|
+
* instead of being added to `context` global object. The new object is returned as `object` parameter.
|
|
633
|
+
* Similar to how jsc_value_new_object() works, if `object_instance` is not %NULL `object_class` must be provided too.
|
|
634
|
+
* The `line_number` is the starting line number in `uri;` the value is one-based so the first line is 1.
|
|
635
|
+
* `uri` and `line_number` will be shown in exceptions and they don't affect the behavior of the script.
|
|
636
|
+
* @param code a JavaScript script to evaluate
|
|
637
|
+
* @param length length of @code, or -1 if @code is a nul-terminated string
|
|
638
|
+
* @param object_instance an object instance
|
|
639
|
+
* @param object_class a #JSCClass or %NULL to use the default
|
|
640
|
+
* @param uri the source URI
|
|
641
|
+
* @param line_number the starting line number
|
|
642
|
+
* @returns a #JSCValue representing the last value generated by the script.
|
|
643
|
+
*/
|
|
644
|
+
evaluate_in_object(
|
|
645
|
+
code: string,
|
|
646
|
+
length: number,
|
|
647
|
+
object_instance: any | null,
|
|
648
|
+
object_class: Class | null,
|
|
649
|
+
uri: string,
|
|
650
|
+
line_number: number,
|
|
651
|
+
): [Value, Value];
|
|
652
|
+
/**
|
|
653
|
+
* Evaluate `code` in `context` using `uri` as the source URI. The `line_number` is the starting line number
|
|
654
|
+
* in `uri;` the value is one-based so the first line is 1. `uri` and `line_number` will be shown in exceptions and
|
|
655
|
+
* they don't affect the behavior of the script.
|
|
656
|
+
* @param code a JavaScript script to evaluate
|
|
657
|
+
* @param length length of @code, or -1 if @code is a nul-terminated string
|
|
658
|
+
* @param uri the source URI
|
|
659
|
+
* @param line_number the starting line number
|
|
660
|
+
* @returns a #JSCValue representing the last value generated by the script.
|
|
661
|
+
*/
|
|
662
|
+
evaluate_with_source_uri(code: string, length: number, uri: string, line_number: number): Value;
|
|
663
|
+
/**
|
|
664
|
+
* Get the last unhandled exception thrown in `context` by API functions calls.
|
|
665
|
+
* @returns a #JSCException or %NULL if there isn't any unhandled exception in the #JSCContext.
|
|
666
|
+
*/
|
|
667
|
+
get_exception(): Exception | null;
|
|
668
|
+
/**
|
|
669
|
+
* Get a #JSCValue referencing the `context` global object
|
|
670
|
+
* @returns a #JSCValue
|
|
671
|
+
*/
|
|
672
|
+
get_global_object(): Value;
|
|
673
|
+
/**
|
|
674
|
+
* Get a property of `context` global object with `name`.
|
|
675
|
+
* @param name the value name
|
|
676
|
+
* @returns a #JSCValue
|
|
677
|
+
*/
|
|
678
|
+
get_value(name: string): Value;
|
|
679
|
+
/**
|
|
680
|
+
* Get the #JSCVirtualMachine where `context` was created.
|
|
681
|
+
* @returns the #JSCVirtualMachine where the #JSCContext was created.
|
|
682
|
+
*/
|
|
683
|
+
get_virtual_machine(): VirtualMachine;
|
|
684
|
+
/**
|
|
685
|
+
* Remove the last #JSCExceptionHandler previously pushed to `context` with
|
|
686
|
+
* jsc_context_push_exception_handler().
|
|
687
|
+
*/
|
|
688
|
+
pop_exception_handler(): void;
|
|
689
|
+
/**
|
|
690
|
+
* Push an exception handler in `context`. Whenever a JavaScript exception happens in
|
|
691
|
+
* the #JSCContext, the given `handler` will be called. The default #JSCExceptionHandler
|
|
692
|
+
* simply calls jsc_context_throw_exception() to throw the exception to the #JSCContext.
|
|
693
|
+
* If you don't want to catch the exception, but only get notified about it, call
|
|
694
|
+
* jsc_context_throw_exception() in `handler` like the default one does.
|
|
695
|
+
* The last exception handler pushed is the only one used by the #JSCContext, use
|
|
696
|
+
* jsc_context_pop_exception_handler() to remove it and set the previous one. When `handler`
|
|
697
|
+
* is removed from the context, `destroy_notify` i called with `user_data` as parameter.
|
|
698
|
+
* @param handler a #JSCExceptionHandler
|
|
699
|
+
* @param destroy_notify destroy notifier for @user_data
|
|
700
|
+
*/
|
|
701
|
+
push_exception_handler(handler: ExceptionHandler, destroy_notify?: GLib.DestroyNotify | null): void;
|
|
702
|
+
/**
|
|
703
|
+
* Register a custom class in `context` using the given `name`. If the new class inherits from
|
|
704
|
+
* another #JSCClass, the parent should be passed as `parent_class,` otherwise %NULL should be
|
|
705
|
+
* used. The optional `vtable` parameter allows to provide a custom implementation for handling
|
|
706
|
+
* the class, for example, to handle external properties not added to the prototype.
|
|
707
|
+
* When an instance of the #JSCClass is cleared in the context, `destroy_notify` is called with
|
|
708
|
+
* the instance as parameter.
|
|
709
|
+
* @param name the class name
|
|
710
|
+
* @param parent_class a #JSCClass or %NULL
|
|
711
|
+
* @param vtable an optional #JSCClassVTable or %NULL
|
|
712
|
+
* @param destroy_notify a destroy notifier for class instances
|
|
713
|
+
* @returns a #JSCClass
|
|
714
|
+
*/
|
|
715
|
+
register_class(
|
|
716
|
+
name: string,
|
|
717
|
+
parent_class?: Class | null,
|
|
718
|
+
vtable?: ClassVTable | null,
|
|
719
|
+
destroy_notify?: GLib.DestroyNotify | null,
|
|
720
|
+
): Class;
|
|
721
|
+
/**
|
|
722
|
+
* Set a property of `context` global object with `name` and `value`.
|
|
723
|
+
* @param name the value name
|
|
724
|
+
* @param value a #JSCValue
|
|
725
|
+
*/
|
|
726
|
+
set_value(name: string, value: Value): void;
|
|
727
|
+
/**
|
|
728
|
+
* Throw an exception to `context` using the given error message. The created #JSCException
|
|
729
|
+
* can be retrieved with jsc_context_get_exception().
|
|
730
|
+
* @param error_message an error message
|
|
731
|
+
*/
|
|
732
|
+
['throw'](error_message: string): void;
|
|
733
|
+
/**
|
|
734
|
+
* Throw `exception` to `context`.
|
|
735
|
+
* @param exception a #JSCException
|
|
736
|
+
*/
|
|
737
|
+
throw_exception(exception: Exception): void;
|
|
738
|
+
/**
|
|
739
|
+
* Throw an exception to `context` using the given error name and message. The created #JSCException
|
|
740
|
+
* can be retrieved with jsc_context_get_exception().
|
|
741
|
+
* @param error_name the error name
|
|
742
|
+
* @param error_message an error message
|
|
631
743
|
*/
|
|
632
|
-
|
|
744
|
+
throw_with_name(error_name: string, error_message: string): void;
|
|
633
745
|
}
|
|
634
746
|
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
interface Context {
|
|
747
|
+
module Exception {
|
|
748
|
+
// Constructor properties interface
|
|
638
749
|
|
|
639
|
-
|
|
750
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {}
|
|
751
|
+
}
|
|
640
752
|
|
|
641
753
|
/**
|
|
642
|
-
*
|
|
754
|
+
* JSCException represents a JavaScript exception.
|
|
643
755
|
*/
|
|
644
|
-
|
|
756
|
+
class Exception extends GObject.Object {
|
|
757
|
+
static $gtype: GObject.GType<Exception>;
|
|
645
758
|
|
|
646
|
-
|
|
759
|
+
// Constructors of JavaScriptCore.Exception
|
|
647
760
|
|
|
648
|
-
|
|
649
|
-
* Check the given `code` in `context` for syntax errors. The `line_number` is the starting line number in `uri;`
|
|
650
|
-
* the value is one-based so the first line is 1. `uri` and `line_number` are only used to fill the `exception`.
|
|
651
|
-
* In case of errors `exception` will be set to a new #JSCException with the details. You can pass %NULL to
|
|
652
|
-
* `exception` to ignore the error details.
|
|
653
|
-
* @param code a JavaScript script to check
|
|
654
|
-
* @param length length of `code,` or -1 if `code` is a nul-terminated string
|
|
655
|
-
* @param mode a #JSCCheckSyntaxMode
|
|
656
|
-
* @param uri the source URI
|
|
657
|
-
* @param line_number the starting line number
|
|
658
|
-
* @returns a #JSCCheckSyntaxResult
|
|
659
|
-
*/
|
|
660
|
-
check_syntax(code: string, length: number, mode: CheckSyntaxMode, uri: string, line_number: number): [ /* returnType */ CheckSyntaxResult, /* exception */ Exception ]
|
|
661
|
-
/**
|
|
662
|
-
* Clear the uncaught exception in `context` if any.
|
|
663
|
-
*/
|
|
664
|
-
clear_exception(): void
|
|
665
|
-
/**
|
|
666
|
-
* Evaluate `code` in `context`.
|
|
667
|
-
* @param code a JavaScript script to evaluate
|
|
668
|
-
* @param length length of `code,` or -1 if `code` is a nul-terminated string
|
|
669
|
-
* @returns a #JSCValue representing the last value generated by the script.
|
|
670
|
-
*/
|
|
671
|
-
evaluate(code: string, length: number): Value
|
|
672
|
-
/**
|
|
673
|
-
* Evaluate `code` and create an new object where symbols defined in `code` will be added as properties,
|
|
674
|
-
* instead of being added to `context` global object. The new object is returned as `object` parameter.
|
|
675
|
-
* Similar to how jsc_value_new_object() works, if `object_instance` is not %NULL `object_class` must be provided too.
|
|
676
|
-
* The `line_number` is the starting line number in `uri;` the value is one-based so the first line is 1.
|
|
677
|
-
* `uri` and `line_number` will be shown in exceptions and they don't affect the behavior of the script.
|
|
678
|
-
* @param code a JavaScript script to evaluate
|
|
679
|
-
* @param length length of `code,` or -1 if `code` is a nul-terminated string
|
|
680
|
-
* @param object_instance an object instance
|
|
681
|
-
* @param object_class a #JSCClass or %NULL to use the default
|
|
682
|
-
* @param uri the source URI
|
|
683
|
-
* @param line_number the starting line number
|
|
684
|
-
* @returns a #JSCValue representing the last value generated by the script.
|
|
685
|
-
*/
|
|
686
|
-
evaluate_in_object(code: string, length: number, object_instance: any | null, object_class: Class | null, uri: string, line_number: number): [ /* returnType */ Value, /* object */ Value ]
|
|
687
|
-
/**
|
|
688
|
-
* Evaluate `code` in `context` using `uri` as the source URI. The `line_number` is the starting line number
|
|
689
|
-
* in `uri;` the value is one-based so the first line is 1. `uri` and `line_number` will be shown in exceptions and
|
|
690
|
-
* they don't affect the behavior of the script.
|
|
691
|
-
* @param code a JavaScript script to evaluate
|
|
692
|
-
* @param length length of `code,` or -1 if `code` is a nul-terminated string
|
|
693
|
-
* @param uri the source URI
|
|
694
|
-
* @param line_number the starting line number
|
|
695
|
-
* @returns a #JSCValue representing the last value generated by the script.
|
|
696
|
-
*/
|
|
697
|
-
evaluate_with_source_uri(code: string, length: number, uri: string, line_number: number): Value
|
|
698
|
-
/**
|
|
699
|
-
* Get the last unhandled exception thrown in `context` by API functions calls.
|
|
700
|
-
* @returns a #JSCException or %NULL if there isn't any unhandled exception in the #JSCContext.
|
|
701
|
-
*/
|
|
702
|
-
get_exception(): Exception | null
|
|
703
|
-
/**
|
|
704
|
-
* Get a #JSCValue referencing the `context` global object
|
|
705
|
-
* @returns a #JSCValue
|
|
706
|
-
*/
|
|
707
|
-
get_global_object(): Value
|
|
708
|
-
/**
|
|
709
|
-
* Get a property of `context` global object with `name`.
|
|
710
|
-
* @param name the value name
|
|
711
|
-
* @returns a #JSCValue
|
|
712
|
-
*/
|
|
713
|
-
get_value(name: string): Value
|
|
714
|
-
/**
|
|
715
|
-
* Get the #JSCVirtualMachine where `context` was created.
|
|
716
|
-
* @returns the #JSCVirtualMachine where the #JSCContext was created.
|
|
717
|
-
*/
|
|
718
|
-
get_virtual_machine(): VirtualMachine
|
|
719
|
-
/**
|
|
720
|
-
* Remove the last #JSCExceptionHandler previously pushed to `context` with
|
|
721
|
-
* jsc_context_push_exception_handler().
|
|
722
|
-
*/
|
|
723
|
-
pop_exception_handler(): void
|
|
724
|
-
/**
|
|
725
|
-
* Push an exception handler in `context`. Whenever a JavaScript exception happens in
|
|
726
|
-
* the #JSCContext, the given `handler` will be called. The default #JSCExceptionHandler
|
|
727
|
-
* simply calls jsc_context_throw_exception() to throw the exception to the #JSCContext.
|
|
728
|
-
* If you don't want to catch the exception, but only get notified about it, call
|
|
729
|
-
* jsc_context_throw_exception() in `handler` like the default one does.
|
|
730
|
-
* The last exception handler pushed is the only one used by the #JSCContext, use
|
|
731
|
-
* jsc_context_pop_exception_handler() to remove it and set the previous one. When `handler`
|
|
732
|
-
* is removed from the context, `destroy_notify` i called with `user_data` as parameter.
|
|
733
|
-
* @param handler a #JSCExceptionHandler
|
|
734
|
-
*/
|
|
735
|
-
push_exception_handler(handler: ExceptionHandler): void
|
|
736
|
-
/**
|
|
737
|
-
* Register a custom class in `context` using the given `name`. If the new class inherits from
|
|
738
|
-
* another #JSCClass, the parent should be passed as `parent_class,` otherwise %NULL should be
|
|
739
|
-
* used. The optional `vtable` parameter allows to provide a custom implementation for handling
|
|
740
|
-
* the class, for example, to handle external properties not added to the prototype.
|
|
741
|
-
* When an instance of the #JSCClass is cleared in the context, `destroy_notify` is called with
|
|
742
|
-
* the instance as parameter.
|
|
743
|
-
* @param name the class name
|
|
744
|
-
* @param parent_class a #JSCClass or %NULL
|
|
745
|
-
* @param vtable an optional #JSCClassVTable or %NULL
|
|
746
|
-
* @param destroy_notify a destroy notifier for class instances
|
|
747
|
-
* @returns a #JSCClass
|
|
748
|
-
*/
|
|
749
|
-
register_class(name: string, parent_class: Class | null, vtable: ClassVTable | null, destroy_notify: GLib.DestroyNotify | null): Class
|
|
750
|
-
/**
|
|
751
|
-
* Set a property of `context` global object with `name` and `value`.
|
|
752
|
-
* @param name the value name
|
|
753
|
-
* @param value a #JSCValue
|
|
754
|
-
*/
|
|
755
|
-
set_value(name: string, value: Value): void
|
|
756
|
-
/**
|
|
757
|
-
* Throw an exception to `context` using the given error message. The created #JSCException
|
|
758
|
-
* can be retrieved with jsc_context_get_exception().
|
|
759
|
-
* @param error_message an error message
|
|
760
|
-
*/
|
|
761
|
-
throw(error_message: string): void
|
|
762
|
-
/**
|
|
763
|
-
* Throw `exception` to `context`.
|
|
764
|
-
* @param exception a #JSCException
|
|
765
|
-
*/
|
|
766
|
-
throw_exception(exception: Exception): void
|
|
767
|
-
/**
|
|
768
|
-
* Throw an exception to `context` using the given error name and message. The created #JSCException
|
|
769
|
-
* can be retrieved with jsc_context_get_exception().
|
|
770
|
-
* @param error_name the error name
|
|
771
|
-
* @param error_message an error message
|
|
772
|
-
*/
|
|
773
|
-
throw_with_name(error_name: string, error_message: string): void
|
|
761
|
+
constructor(properties?: Partial<Exception.ConstructorProps>, ...args: any[]);
|
|
774
762
|
|
|
775
|
-
|
|
763
|
+
_init(...args: any[]): void;
|
|
776
764
|
|
|
777
|
-
|
|
778
|
-
connect_after(sigName: "notify::virtual-machine", callback: (($obj: Context, pspec: GObject.ParamSpec) => void)): number
|
|
779
|
-
emit(sigName: "notify::virtual-machine", ...args: any[]): void
|
|
780
|
-
connect(sigName: string, callback: (...args: any[]) => void): number
|
|
781
|
-
connect_after(sigName: string, callback: (...args: any[]) => void): number
|
|
782
|
-
emit(sigName: string, ...args: any[]): void
|
|
783
|
-
disconnect(id: number): void
|
|
784
|
-
}
|
|
765
|
+
static ['new'](context: Context, message: string): Exception;
|
|
785
766
|
|
|
786
|
-
|
|
787
|
-
* JSCContext represents a JavaScript execution context, where all operations
|
|
788
|
-
* take place and where the values will be associated.
|
|
789
|
-
*
|
|
790
|
-
* When a new context is created, a global object is allocated and the built-in JavaScript
|
|
791
|
-
* objects (Object, Function, String, Array) are populated. You can execute JavaScript in
|
|
792
|
-
* the context by using jsc_context_evaluate() or jsc_context_evaluate_with_source_uri().
|
|
793
|
-
* It's also possible to register custom objects in the context with jsc_context_register_class().
|
|
794
|
-
* @class
|
|
795
|
-
*/
|
|
796
|
-
class Context extends GObject.Object {
|
|
797
|
-
|
|
798
|
-
// Own properties of JavaScriptCore-6.0.JavaScriptCore.Context
|
|
799
|
-
|
|
800
|
-
static name: string
|
|
801
|
-
static $gtype: GObject.GType<Context>
|
|
767
|
+
static new_with_name(context: Context, name: string, message: string): Exception;
|
|
802
768
|
|
|
803
|
-
|
|
769
|
+
// Own methods of JavaScriptCore.Exception
|
|
804
770
|
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
771
|
+
/**
|
|
772
|
+
* Get a string with the exception backtrace.
|
|
773
|
+
* @returns the exception backtrace string or %NULL.
|
|
774
|
+
*/
|
|
775
|
+
get_backtrace_string(): string | null;
|
|
776
|
+
/**
|
|
777
|
+
* Get the column number at which `exception` happened.
|
|
778
|
+
* @returns the column number of @exception.
|
|
779
|
+
*/
|
|
780
|
+
get_column_number(): number;
|
|
781
|
+
/**
|
|
782
|
+
* Get the line number at which `exception` happened.
|
|
783
|
+
* @returns the line number of @exception.
|
|
784
|
+
*/
|
|
785
|
+
get_line_number(): number;
|
|
786
|
+
/**
|
|
787
|
+
* Get the error message of `exception`.
|
|
788
|
+
* @returns the @exception error message.
|
|
789
|
+
*/
|
|
790
|
+
get_message(): string;
|
|
791
|
+
/**
|
|
792
|
+
* Get the error name of `exception`
|
|
793
|
+
* @returns the @exception error name.
|
|
794
|
+
*/
|
|
795
|
+
get_name(): string;
|
|
796
|
+
/**
|
|
797
|
+
* Get the source URI of `exception`.
|
|
798
|
+
* @returns the the source URI of @exception, or %NULL.
|
|
799
|
+
*/
|
|
800
|
+
get_source_uri(): string | null;
|
|
801
|
+
/**
|
|
802
|
+
* Return a report message of `exception,` containing all the possible details such us
|
|
803
|
+
* source URI, line, column and backtrace, and formatted to be printed.
|
|
804
|
+
* @returns a new string with the exception report
|
|
805
|
+
*/
|
|
806
|
+
report(): string;
|
|
807
|
+
/**
|
|
808
|
+
* Get the string representation of `exception` error.
|
|
809
|
+
* @returns the string representation of @exception.
|
|
810
|
+
*/
|
|
811
|
+
to_string(): string;
|
|
843
812
|
}
|
|
844
813
|
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
interface Exception {
|
|
848
|
-
|
|
849
|
-
// Owm methods of JavaScriptCore-6.0.JavaScriptCore.Exception
|
|
850
|
-
|
|
851
|
-
/**
|
|
852
|
-
* Get a string with the exception backtrace.
|
|
853
|
-
* @returns the exception backtrace string or %NULL.
|
|
854
|
-
*/
|
|
855
|
-
get_backtrace_string(): string | null
|
|
856
|
-
/**
|
|
857
|
-
* Get the column number at which `exception` happened.
|
|
858
|
-
* @returns the column number of @exception.
|
|
859
|
-
*/
|
|
860
|
-
get_column_number(): number
|
|
861
|
-
/**
|
|
862
|
-
* Get the line number at which `exception` happened.
|
|
863
|
-
* @returns the line number of @exception.
|
|
864
|
-
*/
|
|
865
|
-
get_line_number(): number
|
|
866
|
-
/**
|
|
867
|
-
* Get the error message of `exception`.
|
|
868
|
-
* @returns the @exception error message.
|
|
869
|
-
*/
|
|
870
|
-
get_message(): string
|
|
871
|
-
/**
|
|
872
|
-
* Get the error name of `exception`
|
|
873
|
-
* @returns the @exception error name.
|
|
874
|
-
*/
|
|
875
|
-
get_name(): string
|
|
876
|
-
/**
|
|
877
|
-
* Get the source URI of `exception`.
|
|
878
|
-
* @returns the the source URI of @exception, or %NULL.
|
|
879
|
-
*/
|
|
880
|
-
get_source_uri(): string | null
|
|
881
|
-
/**
|
|
882
|
-
* Return a report message of `exception,` containing all the possible details such us
|
|
883
|
-
* source URI, line, column and backtrace, and formatted to be printed.
|
|
884
|
-
* @returns a new string with the exception report
|
|
885
|
-
*/
|
|
886
|
-
report(): string | null
|
|
887
|
-
/**
|
|
888
|
-
* Get the string representation of `exception` error.
|
|
889
|
-
* @returns the string representation of @exception.
|
|
890
|
-
*/
|
|
891
|
-
to_string(): string | null
|
|
892
|
-
|
|
893
|
-
// Class property signals of JavaScriptCore-6.0.JavaScriptCore.Exception
|
|
894
|
-
|
|
895
|
-
connect(sigName: string, callback: (...args: any[]) => void): number
|
|
896
|
-
connect_after(sigName: string, callback: (...args: any[]) => void): number
|
|
897
|
-
emit(sigName: string, ...args: any[]): void
|
|
898
|
-
disconnect(id: number): void
|
|
899
|
-
}
|
|
814
|
+
module Value {
|
|
815
|
+
// Constructor properties interface
|
|
900
816
|
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
class Exception extends GObject.Object {
|
|
906
|
-
|
|
907
|
-
// Own properties of JavaScriptCore-6.0.JavaScriptCore.Exception
|
|
908
|
-
|
|
909
|
-
static name: string
|
|
910
|
-
static $gtype: GObject.GType<Exception>
|
|
911
|
-
|
|
912
|
-
// Constructors of JavaScriptCore-6.0.JavaScriptCore.Exception
|
|
817
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {
|
|
818
|
+
context: Context;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
913
821
|
|
|
914
|
-
constructor(config?: Exception.ConstructorProperties)
|
|
915
|
-
/**
|
|
916
|
-
* Create a new #JSCException in `context` with `message`.
|
|
917
|
-
* @constructor
|
|
918
|
-
* @param context a #JSCContext
|
|
919
|
-
* @param message the error message
|
|
920
|
-
* @returns a new #JSCException.
|
|
921
|
-
*/
|
|
922
|
-
constructor(context: Context, message: string)
|
|
923
822
|
/**
|
|
924
|
-
*
|
|
925
|
-
*
|
|
926
|
-
* @param context a #JSCContext
|
|
927
|
-
* @param message the error message
|
|
928
|
-
* @returns a new #JSCException.
|
|
823
|
+
* JSCValue represents a reference to a value in a #JSCContext. The JSCValue
|
|
824
|
+
* protects the referenced value from being garbage collected.
|
|
929
825
|
*/
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
* Create a new #JSCException in `context` with `name` and `message`.
|
|
933
|
-
* @constructor
|
|
934
|
-
* @param context a #JSCContext
|
|
935
|
-
* @param name the error name
|
|
936
|
-
* @param message the error message
|
|
937
|
-
* @returns a new #JSCException.
|
|
938
|
-
*/
|
|
939
|
-
static new_with_name(context: Context, name: string, message: string): Exception
|
|
940
|
-
_init(config?: Exception.ConstructorProperties): void
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
module Value {
|
|
944
|
-
|
|
945
|
-
// Constructor properties interface
|
|
946
|
-
|
|
947
|
-
interface ConstructorProperties extends GObject.Object.ConstructorProperties {
|
|
826
|
+
class Value extends GObject.Object {
|
|
827
|
+
static $gtype: GObject.GType<Value>;
|
|
948
828
|
|
|
949
|
-
// Own
|
|
829
|
+
// Own properties of JavaScriptCore.Value
|
|
950
830
|
|
|
951
831
|
/**
|
|
952
832
|
* The #JSCContext in which the value was created.
|
|
953
833
|
*/
|
|
954
|
-
context
|
|
955
|
-
}
|
|
834
|
+
get context(): Context;
|
|
956
835
|
|
|
957
|
-
|
|
836
|
+
// Constructors of JavaScriptCore.Value
|
|
958
837
|
|
|
959
|
-
|
|
838
|
+
constructor(properties?: Partial<Value.ConstructorProps>, ...args: any[]);
|
|
960
839
|
|
|
961
|
-
|
|
840
|
+
_init(...args: any[]): void;
|
|
962
841
|
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
842
|
+
static new_array_buffer(
|
|
843
|
+
context: Context,
|
|
844
|
+
data: any | null,
|
|
845
|
+
size: number,
|
|
846
|
+
destroy_notify?: GLib.DestroyNotify | null,
|
|
847
|
+
user_data?: any | null,
|
|
848
|
+
): Value;
|
|
967
849
|
|
|
968
|
-
|
|
850
|
+
static new_array_from_garray(context: Context, array?: Value[] | null): Value;
|
|
969
851
|
|
|
970
|
-
|
|
971
|
-
* Gets a pointer to memory that contains the array buffer data.
|
|
972
|
-
*
|
|
973
|
-
* Obtains a pointer to the memory region that holds the contents of the
|
|
974
|
-
* %ArrayBuffer; modifications done to the data will be visible to JavaScript
|
|
975
|
-
* code. If `size` is not %NULL, the size in bytes of the memory region
|
|
976
|
-
* will also be stored in the pointed location.
|
|
977
|
-
*
|
|
978
|
-
* Note that the pointer returned by this function is not guaranteed to remain
|
|
979
|
-
* the same after calls to other JSC API functions. If you plan to access the
|
|
980
|
-
* data of the %ArrayBuffer later, you can keep a reference to the `value` and
|
|
981
|
-
* obtain the data pointer at a later point. Keep in mind that if JavaScript
|
|
982
|
-
* code has a chance to run, for example due to main loop events that result
|
|
983
|
-
* in JSC being called, the contents of the memory region might be modified in
|
|
984
|
-
* the meantime. Consider taking a copy of the data and using the copy instead
|
|
985
|
-
* in asynchronous code.
|
|
986
|
-
* @param size location where to store the size of the memory region.
|
|
987
|
-
* @returns pointer to memory.
|
|
988
|
-
*/
|
|
989
|
-
array_buffer_get_data(size: number | null): any | null
|
|
990
|
-
/**
|
|
991
|
-
* Gets the size in bytes of the array buffer.
|
|
992
|
-
*
|
|
993
|
-
* Obtains the size in bytes of the memory region that holds the contents of
|
|
994
|
-
* an %ArrayBuffer.
|
|
995
|
-
* @returns size, in bytes.
|
|
996
|
-
*/
|
|
997
|
-
array_buffer_get_size(): number
|
|
998
|
-
/**
|
|
999
|
-
* Invoke <function>new</function> with constructor referenced by `value`. If `n_parameters`
|
|
1000
|
-
* is 0 no parameters will be passed to the constructor.
|
|
1001
|
-
* @param parameters the #JSCValue<!-- -->s to pass as parameters to the constructor, or %NULL
|
|
1002
|
-
* @returns a #JSCValue referencing the newly created object instance.
|
|
1003
|
-
*/
|
|
1004
|
-
constructor_call(parameters: Value[] | null): Value
|
|
1005
|
-
/**
|
|
1006
|
-
* Call function referenced by `value,` passing the given `parameters`. If `n_parameters`
|
|
1007
|
-
* is 0 no parameters will be passed to the function.
|
|
1008
|
-
*
|
|
1009
|
-
* This function always returns a #JSCValue, in case of void functions a #JSCValue referencing
|
|
1010
|
-
* <function>undefined</function> is returned
|
|
1011
|
-
* @param parameters the #JSCValue<!-- -->s to pass as parameters to the function, or %NULL
|
|
1012
|
-
* @returns a #JSCValue with the return value of the function.
|
|
1013
|
-
*/
|
|
1014
|
-
function_call(parameters: Value[] | null): Value
|
|
1015
|
-
/**
|
|
1016
|
-
* Get the #JSCContext in which `value` was created.
|
|
1017
|
-
* @returns the #JSCValue context.
|
|
1018
|
-
*/
|
|
1019
|
-
get_context(): Context
|
|
1020
|
-
/**
|
|
1021
|
-
* Get whether the value referenced by `value` is an array.
|
|
1022
|
-
* @returns whether the value is an array.
|
|
1023
|
-
*/
|
|
1024
|
-
is_array(): boolean
|
|
1025
|
-
/**
|
|
1026
|
-
* Check whether the `value` is an %ArrayBuffer.
|
|
1027
|
-
* @returns whether the value is an %ArrayBuffer
|
|
1028
|
-
*/
|
|
1029
|
-
is_array_buffer(): boolean
|
|
1030
|
-
/**
|
|
1031
|
-
* Get whether the value referenced by `value` is a boolean.
|
|
1032
|
-
* @returns whether the value is a boolean.
|
|
1033
|
-
*/
|
|
1034
|
-
is_boolean(): boolean
|
|
1035
|
-
/**
|
|
1036
|
-
* Get whether the value referenced by `value` is a constructor.
|
|
1037
|
-
* @returns whether the value is a constructor.
|
|
1038
|
-
*/
|
|
1039
|
-
is_constructor(): boolean
|
|
1040
|
-
/**
|
|
1041
|
-
* Get whether the value referenced by `value` is a function
|
|
1042
|
-
* @returns whether the value is a function.
|
|
1043
|
-
*/
|
|
1044
|
-
is_function(): boolean
|
|
1045
|
-
/**
|
|
1046
|
-
* Get whether the value referenced by `value` is <function>null</function>.
|
|
1047
|
-
* @returns whether the value is null.
|
|
1048
|
-
*/
|
|
1049
|
-
is_null(): boolean
|
|
1050
|
-
/**
|
|
1051
|
-
* Get whether the value referenced by `value` is a number.
|
|
1052
|
-
* @returns whether the value is a number.
|
|
1053
|
-
*/
|
|
1054
|
-
is_number(): boolean
|
|
1055
|
-
/**
|
|
1056
|
-
* Get whether the value referenced by `value` is an object.
|
|
1057
|
-
* @returns whether the value is an object.
|
|
1058
|
-
*/
|
|
1059
|
-
is_object(): boolean
|
|
1060
|
-
/**
|
|
1061
|
-
* Get whether the value referenced by `value` is a string
|
|
1062
|
-
* @returns whether the value is a string
|
|
1063
|
-
*/
|
|
1064
|
-
is_string(): boolean
|
|
1065
|
-
/**
|
|
1066
|
-
* Determines whether a value is a typed array.
|
|
1067
|
-
* @returns Whether @value is a typed array.
|
|
1068
|
-
*/
|
|
1069
|
-
is_typed_array(): boolean
|
|
1070
|
-
/**
|
|
1071
|
-
* Get whether the value referenced by `value` is <function>undefined</function>.
|
|
1072
|
-
* @returns whether the value is undefined.
|
|
1073
|
-
*/
|
|
1074
|
-
is_undefined(): boolean
|
|
1075
|
-
/**
|
|
1076
|
-
* Create a new typed array value with elements from an array buffer.
|
|
1077
|
-
*
|
|
1078
|
-
* Create a #JSCValue referencing a new typed array value containing
|
|
1079
|
-
* elements of the given `type,` where the elements are stored at the memory
|
|
1080
|
-
* region represented by the `array_buffer`.
|
|
1081
|
-
*
|
|
1082
|
-
* The `type` must *not* be %JSC_TYPED_ARRAY_NONE.
|
|
1083
|
-
*
|
|
1084
|
-
* The `offset` and `length` parameters can be used to indicate which part of
|
|
1085
|
-
* the array buffer can be accessed through the typed array. If both are
|
|
1086
|
-
* omitted (passing zero as `offset,` and `-1` as `length)`, the whole
|
|
1087
|
-
* `array_buffer` is exposed through the typed array. Omitting the `length`
|
|
1088
|
-
* with a non-zero `offset` will expose the remainder of the `array_buffer`
|
|
1089
|
-
* starting at the indicated offset.
|
|
1090
|
-
* @param type type of array elements.
|
|
1091
|
-
* @param offset offset, in bytes.
|
|
1092
|
-
* @param length number of array elements, or `-1`.
|
|
1093
|
-
* @returns a #JSCValue
|
|
1094
|
-
*/
|
|
1095
|
-
new_typed_array_with_buffer(type: TypedArrayType, offset: number, length: number): Value
|
|
1096
|
-
/**
|
|
1097
|
-
* Define or modify a property with `property_name` in object referenced by `value`. When the
|
|
1098
|
-
* property value needs to be getted or set, `getter` and `setter` callbacks will be called.
|
|
1099
|
-
* When the property is cleared in the #JSCClass context, `destroy_notify` is called with
|
|
1100
|
-
* `user_data` as parameter. This is equivalent to JavaScript <function>Object.defineProperty()</function>
|
|
1101
|
-
* when used with an accessor descriptor.
|
|
1102
|
-
*
|
|
1103
|
-
* Note that the value returned by `getter` must be fully transferred. In case of boxed types, you could use
|
|
1104
|
-
* %G_TYPE_POINTER instead of the actual boxed #GType to ensure that the instance owned by #JSCClass is used.
|
|
1105
|
-
* If you really want to return a new copy of the boxed type, use #JSC_TYPE_VALUE and return a #JSCValue created
|
|
1106
|
-
* with jsc_value_new_object() that receives the copy as instance parameter.
|
|
1107
|
-
*
|
|
1108
|
-
* Note that `getter` and `setter` are called as functions and not methods, so they don't receive an instance as
|
|
1109
|
-
* first parameter. Use jsc_class_add_property() if you want to add property accessor invoked as a method.
|
|
1110
|
-
* @param property_name the name of the property to define
|
|
1111
|
-
* @param flags #JSCValuePropertyFlags
|
|
1112
|
-
* @param property_type the #GType of the property
|
|
1113
|
-
* @param getter a #GCallback to be called to get the property value
|
|
1114
|
-
* @param setter a #GCallback to be called to set the property value
|
|
1115
|
-
*/
|
|
1116
|
-
object_define_property_accessor(property_name: string, flags: ValuePropertyFlags, property_type: GObject.GType, getter: GObject.Callback | null, setter: GObject.Callback | null): void
|
|
1117
|
-
/**
|
|
1118
|
-
* Define or modify a property with `property_name` in object referenced by `value`. This is equivalent to
|
|
1119
|
-
* JavaScript <function>Object.defineProperty()</function> when used with a data descriptor.
|
|
1120
|
-
* @param property_name the name of the property to define
|
|
1121
|
-
* @param flags #JSCValuePropertyFlags
|
|
1122
|
-
* @param property_value the default property value
|
|
1123
|
-
*/
|
|
1124
|
-
object_define_property_data(property_name: string, flags: ValuePropertyFlags, property_value: Value | null): void
|
|
1125
|
-
/**
|
|
1126
|
-
* Try to delete property with `name` from `value`. This function will return %FALSE if
|
|
1127
|
-
* the property was defined without %JSC_VALUE_PROPERTY_CONFIGURABLE flag.
|
|
1128
|
-
* @param name the property name
|
|
1129
|
-
* @returns %TRUE if the property was deleted, or %FALSE otherwise.
|
|
1130
|
-
*/
|
|
1131
|
-
object_delete_property(name: string): boolean
|
|
1132
|
-
/**
|
|
1133
|
-
* Get the list of property names of `value`. Only properties defined with %JSC_VALUE_PROPERTY_ENUMERABLE
|
|
1134
|
-
* flag will be collected.
|
|
1135
|
-
* @returns a %NULL-terminated array of strings containing the property names, or %NULL if @value doesn't have enumerable properties. Use g_strfreev() to free.
|
|
1136
|
-
*/
|
|
1137
|
-
object_enumerate_properties(): string[] | null
|
|
1138
|
-
/**
|
|
1139
|
-
* Get property with `name` from `value`.
|
|
1140
|
-
* @param name the property name
|
|
1141
|
-
* @returns the property #JSCValue.
|
|
1142
|
-
*/
|
|
1143
|
-
object_get_property(name: string): Value
|
|
1144
|
-
/**
|
|
1145
|
-
* Get property at `index` from `value`.
|
|
1146
|
-
* @param index the property index
|
|
1147
|
-
* @returns the property #JSCValue.
|
|
1148
|
-
*/
|
|
1149
|
-
object_get_property_at_index(index: number): Value
|
|
1150
|
-
/**
|
|
1151
|
-
* Get whether `value` has property with `name`.
|
|
1152
|
-
* @param name the property name
|
|
1153
|
-
* @returns %TRUE if @value has a property with @name, or %FALSE otherwise
|
|
1154
|
-
*/
|
|
1155
|
-
object_has_property(name: string): boolean
|
|
1156
|
-
/**
|
|
1157
|
-
* Invoke method with `name` on object referenced by `value,` passing the given `parameters`. If
|
|
1158
|
-
* `n_parameters` is 0 no parameters will be passed to the method.
|
|
1159
|
-
* The object instance will be handled automatically even when the method is a custom one
|
|
1160
|
-
* registered with jsc_class_add_method(), so it should never be passed explicitly as parameter
|
|
1161
|
-
* of this function.
|
|
1162
|
-
*
|
|
1163
|
-
* This function always returns a #JSCValue, in case of void methods a #JSCValue referencing
|
|
1164
|
-
* <function>undefined</function> is returned.
|
|
1165
|
-
* @param name the method name
|
|
1166
|
-
* @param parameters the #JSCValue<!-- -->s to pass as parameters to the method, or %NULL
|
|
1167
|
-
* @returns a #JSCValue with the return value of the method.
|
|
1168
|
-
*/
|
|
1169
|
-
object_invoke_method(name: string, parameters: Value[] | null): Value
|
|
1170
|
-
/**
|
|
1171
|
-
* Get whether the value referenced by `value` is an instance of class `name`.
|
|
1172
|
-
* @param name a class name
|
|
1173
|
-
* @returns whether the value is an object instance of class @name.
|
|
1174
|
-
*/
|
|
1175
|
-
object_is_instance_of(name: string): boolean
|
|
1176
|
-
/**
|
|
1177
|
-
* Set `property` with `name` on `value`.
|
|
1178
|
-
* @param name the property name
|
|
1179
|
-
* @param property the #JSCValue to set
|
|
1180
|
-
*/
|
|
1181
|
-
object_set_property(name: string, property: Value): void
|
|
1182
|
-
/**
|
|
1183
|
-
* Set `property` at `index` on `value`.
|
|
1184
|
-
* @param index the property index
|
|
1185
|
-
* @param property the #JSCValue to set
|
|
1186
|
-
*/
|
|
1187
|
-
object_set_property_at_index(index: number, property: Value): void
|
|
1188
|
-
/**
|
|
1189
|
-
* Convert `value` to a boolean.
|
|
1190
|
-
* @returns a #gboolean result of the conversion.
|
|
1191
|
-
*/
|
|
1192
|
-
to_boolean(): boolean
|
|
1193
|
-
/**
|
|
1194
|
-
* Convert `value` to a double.
|
|
1195
|
-
* @returns a #gdouble result of the conversion.
|
|
1196
|
-
*/
|
|
1197
|
-
to_double(): number
|
|
1198
|
-
/**
|
|
1199
|
-
* Convert `value` to a #gint32.
|
|
1200
|
-
* @returns a #gint32 result of the conversion.
|
|
1201
|
-
*/
|
|
1202
|
-
to_int32(): number
|
|
1203
|
-
/**
|
|
1204
|
-
* Create a JSON string of `value` serialization. If `indent` is 0, the resulting JSON will
|
|
1205
|
-
* not contain newlines. The size of the indent is clamped to 10 spaces.
|
|
1206
|
-
* @param indent The number of spaces to indent when nesting.
|
|
1207
|
-
* @returns a null-terminated JSON string with serialization of @value
|
|
1208
|
-
*/
|
|
1209
|
-
to_json(indent: number): string | null
|
|
1210
|
-
/**
|
|
1211
|
-
* Convert `value` to a string. Use jsc_value_to_string_as_bytes() instead, if you need to
|
|
1212
|
-
* handle strings containing null characters.
|
|
1213
|
-
* @returns a null-terminated string result of the conversion.
|
|
1214
|
-
*/
|
|
1215
|
-
to_string(): string | null
|
|
1216
|
-
/**
|
|
1217
|
-
* Convert `value` to a string and return the results as #GBytes. This is needed
|
|
1218
|
-
* to handle strings with null characters.
|
|
1219
|
-
* @returns a #GBytes with the result of the conversion.
|
|
1220
|
-
*/
|
|
1221
|
-
to_string_as_bytes(): GLib.Bytes
|
|
1222
|
-
/**
|
|
1223
|
-
* Obtain the %ArrayBuffer for the memory region of the typed array elements.
|
|
1224
|
-
* @returns A #JSCValue
|
|
1225
|
-
*/
|
|
1226
|
-
typed_array_get_buffer(): Value
|
|
1227
|
-
/**
|
|
1228
|
-
* Obtains a pointer to the memory region that holds the elements of the typed
|
|
1229
|
-
* array; modifications done to them will be visible to JavaScript code. If
|
|
1230
|
-
* `length` is not %NULL, the number of elements contained in the typed array
|
|
1231
|
-
* are also stored in the pointed location.
|
|
1232
|
-
*
|
|
1233
|
-
* The returned pointer needs to be casted to the appropriate type (see
|
|
1234
|
-
* #JSCTypedArrayType), and has the `offset` over the underlying array
|
|
1235
|
-
* buffer data applied—that is, points to the first element of the typed
|
|
1236
|
-
* array:
|
|
1237
|
-
*
|
|
1238
|
-
*
|
|
1239
|
-
* ```c
|
|
1240
|
-
* if (jsc_value_typed_array_get_type(value) != JSC_TYPED_ARRAY_UINT32)
|
|
1241
|
-
* g_error ("Only arrays of uint32_t are supported");
|
|
1242
|
-
*
|
|
1243
|
-
* gsize count = 0;
|
|
1244
|
-
* uint32_t *elements = jsc_value_typed_array_get_contents (value, &count);
|
|
1245
|
-
* for (gsize i = 0; i < count; i++)
|
|
1246
|
-
* g_print ("index %zu, value %" PRIu32 "\n", i, elements[i]);
|
|
1247
|
-
* ```
|
|
1248
|
-
*
|
|
1249
|
-
*
|
|
1250
|
-
* Note that the pointer returned by this function is not guaranteed to remain
|
|
1251
|
-
* the same after calls to other JSC API functions. See
|
|
1252
|
-
* jsc_value_array_buffer_get_data() for details.
|
|
1253
|
-
* @returns pointer to memory.
|
|
1254
|
-
*/
|
|
1255
|
-
typed_array_get_data(): [ /* returnType */ any | null, /* length */ number | null ]
|
|
1256
|
-
/**
|
|
1257
|
-
* Gets the number of elements in a typed array.
|
|
1258
|
-
* @returns number of elements.
|
|
1259
|
-
*/
|
|
1260
|
-
typed_array_get_length(): number
|
|
1261
|
-
/**
|
|
1262
|
-
* Gets the offset over the underlying array buffer data.
|
|
1263
|
-
* @returns offset, in bytes.
|
|
1264
|
-
*/
|
|
1265
|
-
typed_array_get_offset(): number
|
|
1266
|
-
/**
|
|
1267
|
-
* Gets the size of a typed array.
|
|
1268
|
-
* @returns size, in bytes.
|
|
1269
|
-
*/
|
|
1270
|
-
typed_array_get_size(): number
|
|
1271
|
-
/**
|
|
1272
|
-
* Gets the type of elements contained in a typed array.
|
|
1273
|
-
* @returns type of the elements, or %JSC_TYPED_ARRAY_NONE if @value is not a typed array.
|
|
1274
|
-
*/
|
|
1275
|
-
typed_array_get_type(): TypedArrayType
|
|
852
|
+
static new_array_from_strv(context: Context, strv: string[]): Value;
|
|
1276
853
|
|
|
1277
|
-
|
|
854
|
+
static new_boolean(context: Context, value: boolean): Value;
|
|
1278
855
|
|
|
1279
|
-
|
|
1280
|
-
connect_after(sigName: "notify::context", callback: (($obj: Value, pspec: GObject.ParamSpec) => void)): number
|
|
1281
|
-
emit(sigName: "notify::context", ...args: any[]): void
|
|
1282
|
-
connect(sigName: string, callback: (...args: any[]) => void): number
|
|
1283
|
-
connect_after(sigName: string, callback: (...args: any[]) => void): number
|
|
1284
|
-
emit(sigName: string, ...args: any[]): void
|
|
1285
|
-
disconnect(id: number): void
|
|
1286
|
-
}
|
|
856
|
+
static new_from_json(context: Context, json: string): Value;
|
|
1287
857
|
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
858
|
+
static new_function_variadic(
|
|
859
|
+
context: Context,
|
|
860
|
+
name: string | null,
|
|
861
|
+
callback: GObject.Callback,
|
|
862
|
+
destroy_notify: GLib.DestroyNotify | null,
|
|
863
|
+
return_type: GObject.GType,
|
|
864
|
+
): Value;
|
|
1294
865
|
|
|
1295
|
-
|
|
866
|
+
static new_function(
|
|
867
|
+
context: Context,
|
|
868
|
+
name: string | null,
|
|
869
|
+
callback: GObject.Callback,
|
|
870
|
+
destroy_notify: GLib.DestroyNotify | null,
|
|
871
|
+
return_type: GObject.GType,
|
|
872
|
+
parameter_types?: GObject.GType[] | null,
|
|
873
|
+
): Value;
|
|
1296
874
|
|
|
1297
|
-
|
|
1298
|
-
static $gtype: GObject.GType<Value>
|
|
875
|
+
static new_null(context: Context): Value;
|
|
1299
876
|
|
|
1300
|
-
|
|
877
|
+
static new_number(context: Context, number: number): Value;
|
|
1301
878
|
|
|
1302
|
-
|
|
1303
|
-
/**
|
|
1304
|
-
* Creates a new %ArrayBuffer from existing `data` in memory.
|
|
1305
|
-
*
|
|
1306
|
-
* The `data` is not copied: while this allows sharing data with JavaScript
|
|
1307
|
-
* efficiently, the caller must ensure that the memory region remains valid
|
|
1308
|
-
* until the newly created object is released by JSC.
|
|
1309
|
-
*
|
|
1310
|
-
* Optionally, a `destroy_notify` callback can be provided, which will be
|
|
1311
|
-
* invoked with `user_data` as parameter when the %ArrayBuffer object is
|
|
1312
|
-
* released. This is intended to be used for freeing resources related to
|
|
1313
|
-
* the memory region which contains the data:
|
|
1314
|
-
*
|
|
1315
|
-
*
|
|
1316
|
-
* ```!<-- language="C" -->
|
|
1317
|
-
* GMappedFile *f = g_mapped_file_new (file_path, TRUE, NULL);
|
|
1318
|
-
* JSCValue *value = jsc_value_new_array_buffer (context,
|
|
1319
|
-
* g_mapped_file_get_contents (f), g_mapped_file_get_length (f),
|
|
1320
|
-
* (GDestroyNotify) g_mapped_file_unref, f);
|
|
1321
|
-
* ```
|
|
1322
|
-
*
|
|
1323
|
-
*
|
|
1324
|
-
* Note that the `user_data` can be the same value as `data:`
|
|
1325
|
-
*
|
|
1326
|
-
*
|
|
1327
|
-
* ```!<-- language="C" -->
|
|
1328
|
-
* void *bytes = g_malloc0 (100);
|
|
1329
|
-
* JSCValue *value = jsc_value_new_array_buffer (context, bytes, 100, g_free, bytes);
|
|
1330
|
-
* ```
|
|
1331
|
-
*
|
|
1332
|
-
* @constructor
|
|
1333
|
-
* @param context A #JSCContext
|
|
1334
|
-
* @param data Pointer to a region of memory.
|
|
1335
|
-
* @param size Size in bytes of the memory region.
|
|
1336
|
-
* @param destroy_notify destroy notifier for `user_data`.
|
|
1337
|
-
* @param user_data user data.
|
|
1338
|
-
* @returns A #JSCValue, or %NULL in case of exception.
|
|
1339
|
-
*/
|
|
1340
|
-
static new_array_buffer(context: Context, data: any | null, size: number, destroy_notify: GLib.DestroyNotify | null, user_data: any | null): Value
|
|
1341
|
-
/**
|
|
1342
|
-
* Create a new #JSCValue referencing an array with the items from `array`. If `array`
|
|
1343
|
-
* is %NULL or empty a new empty array will be created. Elements of `array` should be
|
|
1344
|
-
* pointers to a #JSCValue.
|
|
1345
|
-
* @constructor
|
|
1346
|
-
* @param context a #JSCContext
|
|
1347
|
-
* @param array a #GPtrArray
|
|
1348
|
-
* @returns a #JSCValue.
|
|
1349
|
-
*/
|
|
1350
|
-
static new_array_from_garray(context: Context, array: Value[] | null): Value
|
|
1351
|
-
/**
|
|
1352
|
-
* Create a new #JSCValue referencing an array of strings with the items from `strv`. If `array`
|
|
1353
|
-
* is %NULL or empty a new empty array will be created.
|
|
1354
|
-
* @constructor
|
|
1355
|
-
* @param context a #JSCContext
|
|
1356
|
-
* @param strv a %NULL-terminated array of strings
|
|
1357
|
-
* @returns a #JSCValue.
|
|
1358
|
-
*/
|
|
1359
|
-
static new_array_from_strv(context: Context, strv: string[]): Value
|
|
1360
|
-
/**
|
|
1361
|
-
* Create a new #JSCValue from `value`
|
|
1362
|
-
* @constructor
|
|
1363
|
-
* @param context a #JSCContext
|
|
1364
|
-
* @param value a #gboolean
|
|
1365
|
-
* @returns a #JSCValue.
|
|
1366
|
-
*/
|
|
1367
|
-
static new_boolean(context: Context, value: boolean): Value
|
|
1368
|
-
/**
|
|
1369
|
-
* Create a new #JSCValue referencing a new value created by parsing `json`.
|
|
1370
|
-
* @constructor
|
|
1371
|
-
* @param context a #JSCContext
|
|
1372
|
-
* @param json the JSON string to be parsed
|
|
1373
|
-
* @returns a #JSCValue.
|
|
1374
|
-
*/
|
|
1375
|
-
static new_from_json(context: Context, json: string): Value
|
|
1376
|
-
/**
|
|
1377
|
-
* Create a function in `context`. If `name` is %NULL an anonymous function will be created.
|
|
1378
|
-
* When the function is called by JavaScript or jsc_value_function_call(), `callback` is called
|
|
1379
|
-
* receiving an #GPtrArray of #JSCValue<!-- -->s with the arguments and then `user_data` as last parameter.
|
|
1380
|
-
* When the function is cleared in `context,` `destroy_notify` is called with `user_data` as parameter.
|
|
1381
|
-
*
|
|
1382
|
-
* Note that the value returned by `callback` must be fully transferred. In case of boxed types, you could use
|
|
1383
|
-
* %G_TYPE_POINTER instead of the actual boxed #GType to ensure that the instance owned by #JSCClass is used.
|
|
1384
|
-
* If you really want to return a new copy of the boxed type, use #JSC_TYPE_VALUE and return a #JSCValue created
|
|
1385
|
-
* with jsc_value_new_object() that receives the copy as instance parameter.
|
|
1386
|
-
* @constructor
|
|
1387
|
-
* @param context a #JSCContext
|
|
1388
|
-
* @param name the function name or %NULL
|
|
1389
|
-
* @param callback a #GCallback.
|
|
1390
|
-
* @param return_type the #GType of the function return value, or %G_TYPE_NONE if the function is void.
|
|
1391
|
-
* @returns a #JSCValue.
|
|
1392
|
-
*/
|
|
1393
|
-
static new_function_variadic(context: Context, name: string | null, callback: GObject.Callback, return_type: GObject.GType): Value
|
|
1394
|
-
/**
|
|
1395
|
-
* Create a function in `context`. If `name` is %NULL an anonymous function will be created.
|
|
1396
|
-
* When the function is called by JavaScript or jsc_value_function_call(), `callback` is called
|
|
1397
|
-
* receiving the function parameters and then `user_data` as last parameter. When the function is
|
|
1398
|
-
* cleared in `context,` `destroy_notify` is called with `user_data` as parameter.
|
|
1399
|
-
*
|
|
1400
|
-
* Note that the value returned by `callback` must be fully transferred. In case of boxed types, you could use
|
|
1401
|
-
* %G_TYPE_POINTER instead of the actual boxed #GType to ensure that the instance owned by #JSCClass is used.
|
|
1402
|
-
* If you really want to return a new copy of the boxed type, use #JSC_TYPE_VALUE and return a #JSCValue created
|
|
1403
|
-
* with jsc_value_new_object() that receives the copy as instance parameter.
|
|
1404
|
-
* @constructor
|
|
1405
|
-
* @param context a #JSCContext
|
|
1406
|
-
* @param name the function name or %NULL
|
|
1407
|
-
* @param callback a #GCallback.
|
|
1408
|
-
* @param return_type the #GType of the function return value, or %G_TYPE_NONE if the function is void.
|
|
1409
|
-
* @param parameter_types a list of #GType<!-- -->s, one for each parameter, or %NULL
|
|
1410
|
-
* @returns a #JSCValue.
|
|
1411
|
-
*/
|
|
1412
|
-
static new_function(context: Context, name: string | null, callback: GObject.Callback, return_type: GObject.GType, parameter_types: GObject.GType[] | null): Value
|
|
1413
|
-
/**
|
|
1414
|
-
* Create a new #JSCValue referencing <function>null</function> in `context`.
|
|
1415
|
-
* @constructor
|
|
1416
|
-
* @param context a #JSCContext
|
|
1417
|
-
* @returns a #JSCValue.
|
|
1418
|
-
*/
|
|
1419
|
-
static new_null(context: Context): Value
|
|
1420
|
-
/**
|
|
1421
|
-
* Create a new #JSCValue from `number`.
|
|
1422
|
-
* @constructor
|
|
1423
|
-
* @param context a #JSCContext
|
|
1424
|
-
* @param number a number
|
|
1425
|
-
* @returns a #JSCValue.
|
|
1426
|
-
*/
|
|
1427
|
-
static new_number(context: Context, number: number): Value
|
|
1428
|
-
/**
|
|
1429
|
-
* Create a new #JSCValue from `instance`. If `instance` is %NULL a new empty object is created.
|
|
1430
|
-
* When `instance` is provided, `jsc_class` must be provided too. `jsc_class` takes ownership of
|
|
1431
|
-
* `instance` that will be freed by the #GDestroyNotify passed to jsc_context_register_class().
|
|
1432
|
-
* @constructor
|
|
1433
|
-
* @param context a #JSCContext
|
|
1434
|
-
* @param instance an object instance or %NULL
|
|
1435
|
-
* @param jsc_class the #JSCClass of `instance`
|
|
1436
|
-
* @returns a #JSCValue.
|
|
1437
|
-
*/
|
|
1438
|
-
static new_object(context: Context, instance: any | null, jsc_class: Class | null): Value
|
|
1439
|
-
/**
|
|
1440
|
-
* Create a new #JSCValue from `string`. If you need to create a #JSCValue from a
|
|
1441
|
-
* string containing null characters, use jsc_value_new_string_from_bytes() instead.
|
|
1442
|
-
* @constructor
|
|
1443
|
-
* @param context a #JSCContext
|
|
1444
|
-
* @param string a null-terminated string
|
|
1445
|
-
* @returns a #JSCValue.
|
|
1446
|
-
*/
|
|
1447
|
-
static new_string(context: Context, string: string | null): Value
|
|
1448
|
-
/**
|
|
1449
|
-
* Create a new #JSCValue from `bytes`.
|
|
1450
|
-
* @constructor
|
|
1451
|
-
* @param context a #JSCContext
|
|
1452
|
-
* @param bytes a #GBytes
|
|
1453
|
-
* @returns a #JSCValue.
|
|
1454
|
-
*/
|
|
1455
|
-
static new_string_from_bytes(context: Context, bytes: GLib.Bytes | null): Value
|
|
1456
|
-
/**
|
|
1457
|
-
* Create a new typed array containing a given amount of elements.
|
|
1458
|
-
*
|
|
1459
|
-
* Create a #JSCValue referencing a new typed array with space for `length`
|
|
1460
|
-
* elements of a given `type`. As all typed arrays must have an associated
|
|
1461
|
-
* `ArrayBuffer`, a new one of suitable size will be allocated to store
|
|
1462
|
-
* the elements, which will be initialized to zero.
|
|
1463
|
-
*
|
|
1464
|
-
* The `type` must *not* be %JSC_TYPED_ARRAY_NONE.
|
|
1465
|
-
* @constructor
|
|
1466
|
-
* @param context a #JSCContext
|
|
1467
|
-
* @param type the type of array elements
|
|
1468
|
-
* @param length number of elements in the array
|
|
1469
|
-
* @returns a #JSCValue
|
|
1470
|
-
*/
|
|
1471
|
-
static new_typed_array(context: Context, type: TypedArrayType, length: number): Value
|
|
1472
|
-
/**
|
|
1473
|
-
* Create a new #JSCValue referencing <function>undefined</function> in `context`.
|
|
1474
|
-
* @constructor
|
|
1475
|
-
* @param context a #JSCContext
|
|
1476
|
-
* @returns a #JSCValue.
|
|
1477
|
-
*/
|
|
1478
|
-
static new_undefined(context: Context): Value
|
|
1479
|
-
_init(config?: Value.ConstructorProperties): void
|
|
1480
|
-
}
|
|
1481
|
-
|
|
1482
|
-
module VirtualMachine {
|
|
1483
|
-
|
|
1484
|
-
// Constructor properties interface
|
|
1485
|
-
|
|
1486
|
-
interface ConstructorProperties extends GObject.Object.ConstructorProperties {
|
|
1487
|
-
}
|
|
879
|
+
static new_object(context: Context, instance?: any | null, jsc_class?: Class | null): Value;
|
|
1488
880
|
|
|
1489
|
-
|
|
881
|
+
static new_string(context: Context, string?: string | null): Value;
|
|
1490
882
|
|
|
1491
|
-
|
|
883
|
+
static new_string_from_bytes(context: Context, bytes?: GLib.Bytes | null): Value;
|
|
1492
884
|
|
|
1493
|
-
|
|
885
|
+
static new_typed_array(context: Context, type: TypedArrayType, length: number): Value;
|
|
1494
886
|
|
|
1495
|
-
|
|
1496
|
-
connect_after(sigName: string, callback: (...args: any[]) => void): number
|
|
1497
|
-
emit(sigName: string, ...args: any[]): void
|
|
1498
|
-
disconnect(id: number): void
|
|
1499
|
-
}
|
|
887
|
+
static new_undefined(context: Context): Value;
|
|
1500
888
|
|
|
1501
|
-
|
|
1502
|
-
* JSCVirtualMachine represents a group of JSCContext<!-- -->s. It allows
|
|
1503
|
-
* concurrent JavaScript execution by creating a different instance of
|
|
1504
|
-
* JSCVirtualMachine in each thread.
|
|
1505
|
-
*
|
|
1506
|
-
* To create a group of JSCContext<!-- -->s pass the same JSCVirtualMachine
|
|
1507
|
-
* instance to every JSCContext constructor.
|
|
1508
|
-
* @class
|
|
1509
|
-
*/
|
|
1510
|
-
class VirtualMachine extends GObject.Object {
|
|
889
|
+
// Own methods of JavaScriptCore.Value
|
|
1511
890
|
|
|
1512
|
-
|
|
891
|
+
/**
|
|
892
|
+
* Gets a pointer to memory that contains the array buffer data.
|
|
893
|
+
*
|
|
894
|
+
* Obtains a pointer to the memory region that holds the contents of the
|
|
895
|
+
* %ArrayBuffer; modifications done to the data will be visible to JavaScript
|
|
896
|
+
* code. If `size` is not %NULL, the size in bytes of the memory region
|
|
897
|
+
* will also be stored in the pointed location.
|
|
898
|
+
*
|
|
899
|
+
* Note that the pointer returned by this function is not guaranteed to remain
|
|
900
|
+
* the same after calls to other JSC API functions. If you plan to access the
|
|
901
|
+
* data of the %ArrayBuffer later, you can keep a reference to the `value` and
|
|
902
|
+
* obtain the data pointer at a later point. Keep in mind that if JavaScript
|
|
903
|
+
* code has a chance to run, for example due to main loop events that result
|
|
904
|
+
* in JSC being called, the contents of the memory region might be modified in
|
|
905
|
+
* the meantime. Consider taking a copy of the data and using the copy instead
|
|
906
|
+
* in asynchronous code.
|
|
907
|
+
* @param size location where to store the size of the memory region.
|
|
908
|
+
* @returns pointer to memory.
|
|
909
|
+
*/
|
|
910
|
+
array_buffer_get_data(size?: number | null): any | null;
|
|
911
|
+
/**
|
|
912
|
+
* Gets the size in bytes of the array buffer.
|
|
913
|
+
*
|
|
914
|
+
* Obtains the size in bytes of the memory region that holds the contents of
|
|
915
|
+
* an %ArrayBuffer.
|
|
916
|
+
* @returns size, in bytes.
|
|
917
|
+
*/
|
|
918
|
+
array_buffer_get_size(): number;
|
|
919
|
+
/**
|
|
920
|
+
* Invoke <function>new</function> with constructor referenced by `value`. If `n_parameters`
|
|
921
|
+
* is 0 no parameters will be passed to the constructor.
|
|
922
|
+
* @param parameters the #JSCValue<!-- -->s to pass as parameters to the constructor, or %NULL
|
|
923
|
+
* @returns a #JSCValue referencing the newly created object instance.
|
|
924
|
+
*/
|
|
925
|
+
constructor_call(parameters?: Value[] | null): Value;
|
|
926
|
+
/**
|
|
927
|
+
* Call function referenced by `value,` passing the given `parameters`. If `n_parameters`
|
|
928
|
+
* is 0 no parameters will be passed to the function.
|
|
929
|
+
*
|
|
930
|
+
* This function always returns a #JSCValue, in case of void functions a #JSCValue referencing
|
|
931
|
+
* <function>undefined</function> is returned
|
|
932
|
+
* @param parameters the #JSCValue<!-- -->s to pass as parameters to the function, or %NULL
|
|
933
|
+
* @returns a #JSCValue with the return value of the function.
|
|
934
|
+
*/
|
|
935
|
+
function_call(parameters?: Value[] | null): Value;
|
|
936
|
+
/**
|
|
937
|
+
* Get the #JSCContext in which `value` was created.
|
|
938
|
+
* @returns the #JSCValue context.
|
|
939
|
+
*/
|
|
940
|
+
get_context(): Context;
|
|
941
|
+
/**
|
|
942
|
+
* Get whether the value referenced by `value` is an array.
|
|
943
|
+
* @returns whether the value is an array.
|
|
944
|
+
*/
|
|
945
|
+
is_array(): boolean;
|
|
946
|
+
/**
|
|
947
|
+
* Check whether the `value` is an %ArrayBuffer.
|
|
948
|
+
* @returns whether the value is an %ArrayBuffer
|
|
949
|
+
*/
|
|
950
|
+
is_array_buffer(): boolean;
|
|
951
|
+
/**
|
|
952
|
+
* Get whether the value referenced by `value` is a boolean.
|
|
953
|
+
* @returns whether the value is a boolean.
|
|
954
|
+
*/
|
|
955
|
+
is_boolean(): boolean;
|
|
956
|
+
/**
|
|
957
|
+
* Get whether the value referenced by `value` is a constructor.
|
|
958
|
+
* @returns whether the value is a constructor.
|
|
959
|
+
*/
|
|
960
|
+
is_constructor(): boolean;
|
|
961
|
+
/**
|
|
962
|
+
* Get whether the value referenced by `value` is a function
|
|
963
|
+
* @returns whether the value is a function.
|
|
964
|
+
*/
|
|
965
|
+
is_function(): boolean;
|
|
966
|
+
/**
|
|
967
|
+
* Get whether the value referenced by `value` is <function>null</function>.
|
|
968
|
+
* @returns whether the value is null.
|
|
969
|
+
*/
|
|
970
|
+
is_null(): boolean;
|
|
971
|
+
/**
|
|
972
|
+
* Get whether the value referenced by `value` is a number.
|
|
973
|
+
* @returns whether the value is a number.
|
|
974
|
+
*/
|
|
975
|
+
is_number(): boolean;
|
|
976
|
+
/**
|
|
977
|
+
* Get whether the value referenced by `value` is an object.
|
|
978
|
+
* @returns whether the value is an object.
|
|
979
|
+
*/
|
|
980
|
+
is_object(): boolean;
|
|
981
|
+
/**
|
|
982
|
+
* Get whether the value referenced by `value` is a string
|
|
983
|
+
* @returns whether the value is a string
|
|
984
|
+
*/
|
|
985
|
+
is_string(): boolean;
|
|
986
|
+
/**
|
|
987
|
+
* Determines whether a value is a typed array.
|
|
988
|
+
* @returns Whether @value is a typed array.
|
|
989
|
+
*/
|
|
990
|
+
is_typed_array(): boolean;
|
|
991
|
+
/**
|
|
992
|
+
* Get whether the value referenced by `value` is <function>undefined</function>.
|
|
993
|
+
* @returns whether the value is undefined.
|
|
994
|
+
*/
|
|
995
|
+
is_undefined(): boolean;
|
|
996
|
+
/**
|
|
997
|
+
* Create a new typed array value with elements from an array buffer.
|
|
998
|
+
*
|
|
999
|
+
* Create a #JSCValue referencing a new typed array value containing
|
|
1000
|
+
* elements of the given `type,` where the elements are stored at the memory
|
|
1001
|
+
* region represented by the `array_buffer`.
|
|
1002
|
+
*
|
|
1003
|
+
* The `type` must *not* be %JSC_TYPED_ARRAY_NONE.
|
|
1004
|
+
*
|
|
1005
|
+
* The `offset` and `length` parameters can be used to indicate which part of
|
|
1006
|
+
* the array buffer can be accessed through the typed array. If both are
|
|
1007
|
+
* omitted (passing zero as `offset,` and `-1` as `length)`, the whole
|
|
1008
|
+
* `array_buffer` is exposed through the typed array. Omitting the `length`
|
|
1009
|
+
* with a non-zero `offset` will expose the remainder of the `array_buffer`
|
|
1010
|
+
* starting at the indicated offset.
|
|
1011
|
+
* @param type type of array elements.
|
|
1012
|
+
* @param offset offset, in bytes.
|
|
1013
|
+
* @param length number of array elements, or `-1`.
|
|
1014
|
+
* @returns a #JSCValue
|
|
1015
|
+
*/
|
|
1016
|
+
new_typed_array_with_buffer(type: TypedArrayType, offset: number, length: number): Value;
|
|
1017
|
+
/**
|
|
1018
|
+
* Define or modify a property with `property_name` in object referenced by `value`. When the
|
|
1019
|
+
* property value needs to be getted or set, `getter` and `setter` callbacks will be called.
|
|
1020
|
+
* When the property is cleared in the #JSCClass context, `destroy_notify` is called with
|
|
1021
|
+
* `user_data` as parameter. This is equivalent to JavaScript <function>Object.defineProperty()</function>
|
|
1022
|
+
* when used with an accessor descriptor.
|
|
1023
|
+
*
|
|
1024
|
+
* Note that the value returned by `getter` must be fully transferred. In case of boxed types, you could use
|
|
1025
|
+
* %G_TYPE_POINTER instead of the actual boxed #GType to ensure that the instance owned by #JSCClass is used.
|
|
1026
|
+
* If you really want to return a new copy of the boxed type, use #JSC_TYPE_VALUE and return a #JSCValue created
|
|
1027
|
+
* with jsc_value_new_object() that receives the copy as instance parameter.
|
|
1028
|
+
*
|
|
1029
|
+
* Note that `getter` and `setter` are called as functions and not methods, so they don't receive an instance as
|
|
1030
|
+
* first parameter. Use jsc_class_add_property() if you want to add property accessor invoked as a method.
|
|
1031
|
+
* @param property_name the name of the property to define
|
|
1032
|
+
* @param flags #JSCValuePropertyFlags
|
|
1033
|
+
* @param property_type the #GType of the property
|
|
1034
|
+
* @param getter a #GCallback to be called to get the property value
|
|
1035
|
+
* @param setter a #GCallback to be called to set the property value
|
|
1036
|
+
* @param destroy_notify destroy notifier for @user_data
|
|
1037
|
+
*/
|
|
1038
|
+
object_define_property_accessor(
|
|
1039
|
+
property_name: string,
|
|
1040
|
+
flags: ValuePropertyFlags,
|
|
1041
|
+
property_type: GObject.GType,
|
|
1042
|
+
getter?: GObject.Callback | null,
|
|
1043
|
+
setter?: GObject.Callback | null,
|
|
1044
|
+
destroy_notify?: GLib.DestroyNotify | null,
|
|
1045
|
+
): void;
|
|
1046
|
+
/**
|
|
1047
|
+
* Define or modify a property with `property_name` in object referenced by `value`. This is equivalent to
|
|
1048
|
+
* JavaScript <function>Object.defineProperty()</function> when used with a data descriptor.
|
|
1049
|
+
* @param property_name the name of the property to define
|
|
1050
|
+
* @param flags #JSCValuePropertyFlags
|
|
1051
|
+
* @param property_value the default property value
|
|
1052
|
+
*/
|
|
1053
|
+
object_define_property_data(
|
|
1054
|
+
property_name: string,
|
|
1055
|
+
flags: ValuePropertyFlags,
|
|
1056
|
+
property_value?: Value | null,
|
|
1057
|
+
): void;
|
|
1058
|
+
/**
|
|
1059
|
+
* Try to delete property with `name` from `value`. This function will return %FALSE if
|
|
1060
|
+
* the property was defined without %JSC_VALUE_PROPERTY_CONFIGURABLE flag.
|
|
1061
|
+
* @param name the property name
|
|
1062
|
+
* @returns %TRUE if the property was deleted, or %FALSE otherwise.
|
|
1063
|
+
*/
|
|
1064
|
+
object_delete_property(name: string): boolean;
|
|
1065
|
+
/**
|
|
1066
|
+
* Get the list of property names of `value`. Only properties defined with %JSC_VALUE_PROPERTY_ENUMERABLE
|
|
1067
|
+
* flag will be collected.
|
|
1068
|
+
* @returns a %NULL-terminated array of strings containing the property names, or %NULL if @value doesn't have enumerable properties. Use g_strfreev() to free.
|
|
1069
|
+
*/
|
|
1070
|
+
object_enumerate_properties(): string[] | null;
|
|
1071
|
+
/**
|
|
1072
|
+
* Get property with `name` from `value`.
|
|
1073
|
+
* @param name the property name
|
|
1074
|
+
* @returns the property #JSCValue.
|
|
1075
|
+
*/
|
|
1076
|
+
object_get_property(name: string): Value;
|
|
1077
|
+
/**
|
|
1078
|
+
* Get property at `index` from `value`.
|
|
1079
|
+
* @param index the property index
|
|
1080
|
+
* @returns the property #JSCValue.
|
|
1081
|
+
*/
|
|
1082
|
+
object_get_property_at_index(index: number): Value;
|
|
1083
|
+
/**
|
|
1084
|
+
* Get whether `value` has property with `name`.
|
|
1085
|
+
* @param name the property name
|
|
1086
|
+
* @returns %TRUE if @value has a property with @name, or %FALSE otherwise
|
|
1087
|
+
*/
|
|
1088
|
+
object_has_property(name: string): boolean;
|
|
1089
|
+
/**
|
|
1090
|
+
* Invoke method with `name` on object referenced by `value,` passing the given `parameters`. If
|
|
1091
|
+
* `n_parameters` is 0 no parameters will be passed to the method.
|
|
1092
|
+
* The object instance will be handled automatically even when the method is a custom one
|
|
1093
|
+
* registered with jsc_class_add_method(), so it should never be passed explicitly as parameter
|
|
1094
|
+
* of this function.
|
|
1095
|
+
*
|
|
1096
|
+
* This function always returns a #JSCValue, in case of void methods a #JSCValue referencing
|
|
1097
|
+
* <function>undefined</function> is returned.
|
|
1098
|
+
* @param name the method name
|
|
1099
|
+
* @param parameters the #JSCValue<!-- -->s to pass as parameters to the method, or %NULL
|
|
1100
|
+
* @returns a #JSCValue with the return value of the method.
|
|
1101
|
+
*/
|
|
1102
|
+
object_invoke_method(name: string, parameters?: Value[] | null): Value;
|
|
1103
|
+
/**
|
|
1104
|
+
* Get whether the value referenced by `value` is an instance of class `name`.
|
|
1105
|
+
* @param name a class name
|
|
1106
|
+
* @returns whether the value is an object instance of class @name.
|
|
1107
|
+
*/
|
|
1108
|
+
object_is_instance_of(name: string): boolean;
|
|
1109
|
+
/**
|
|
1110
|
+
* Set `property` with `name` on `value`.
|
|
1111
|
+
* @param name the property name
|
|
1112
|
+
* @param property the #JSCValue to set
|
|
1113
|
+
*/
|
|
1114
|
+
object_set_property(name: string, property: Value): void;
|
|
1115
|
+
/**
|
|
1116
|
+
* Set `property` at `index` on `value`.
|
|
1117
|
+
* @param index the property index
|
|
1118
|
+
* @param property the #JSCValue to set
|
|
1119
|
+
*/
|
|
1120
|
+
object_set_property_at_index(index: number, property: Value): void;
|
|
1121
|
+
/**
|
|
1122
|
+
* Convert `value` to a boolean.
|
|
1123
|
+
* @returns a #gboolean result of the conversion.
|
|
1124
|
+
*/
|
|
1125
|
+
to_boolean(): boolean;
|
|
1126
|
+
/**
|
|
1127
|
+
* Convert `value` to a double.
|
|
1128
|
+
* @returns a #gdouble result of the conversion.
|
|
1129
|
+
*/
|
|
1130
|
+
to_double(): number;
|
|
1131
|
+
/**
|
|
1132
|
+
* Convert `value` to a #gint32.
|
|
1133
|
+
* @returns a #gint32 result of the conversion.
|
|
1134
|
+
*/
|
|
1135
|
+
to_int32(): number;
|
|
1136
|
+
/**
|
|
1137
|
+
* Create a JSON string of `value` serialization. If `indent` is 0, the resulting JSON will
|
|
1138
|
+
* not contain newlines. The size of the indent is clamped to 10 spaces.
|
|
1139
|
+
* @param indent The number of spaces to indent when nesting.
|
|
1140
|
+
* @returns a null-terminated JSON string with serialization of @value
|
|
1141
|
+
*/
|
|
1142
|
+
to_json(indent: number): string;
|
|
1143
|
+
/**
|
|
1144
|
+
* Convert `value` to a string. Use jsc_value_to_string_as_bytes() instead, if you need to
|
|
1145
|
+
* handle strings containing null characters.
|
|
1146
|
+
* @returns a null-terminated string result of the conversion.
|
|
1147
|
+
*/
|
|
1148
|
+
to_string(): string;
|
|
1149
|
+
/**
|
|
1150
|
+
* Convert `value` to a string and return the results as #GBytes. This is needed
|
|
1151
|
+
* to handle strings with null characters.
|
|
1152
|
+
* @returns a #GBytes with the result of the conversion.
|
|
1153
|
+
*/
|
|
1154
|
+
to_string_as_bytes(): GLib.Bytes;
|
|
1155
|
+
/**
|
|
1156
|
+
* Obtain the %ArrayBuffer for the memory region of the typed array elements.
|
|
1157
|
+
* @returns A #JSCValue
|
|
1158
|
+
*/
|
|
1159
|
+
typed_array_get_buffer(): Value;
|
|
1160
|
+
/**
|
|
1161
|
+
* Obtains a pointer to the memory region that holds the elements of the typed
|
|
1162
|
+
* array; modifications done to them will be visible to JavaScript code. If
|
|
1163
|
+
* `length` is not %NULL, the number of elements contained in the typed array
|
|
1164
|
+
* are also stored in the pointed location.
|
|
1165
|
+
*
|
|
1166
|
+
* The returned pointer needs to be casted to the appropriate type (see
|
|
1167
|
+
* #JSCTypedArrayType), and has the `offset` over the underlying array
|
|
1168
|
+
* buffer data applied—that is, points to the first element of the typed
|
|
1169
|
+
* array:
|
|
1170
|
+
*
|
|
1171
|
+
*
|
|
1172
|
+
* ```c
|
|
1173
|
+
* if (jsc_value_typed_array_get_type(value) != JSC_TYPED_ARRAY_UINT32)
|
|
1174
|
+
* g_error ("Only arrays of uint32_t are supported");
|
|
1175
|
+
*
|
|
1176
|
+
* gsize count = 0;
|
|
1177
|
+
* uint32_t *elements = jsc_value_typed_array_get_contents (value, &count);
|
|
1178
|
+
* for (gsize i = 0; i < count; i++)
|
|
1179
|
+
* g_print ("index %zu, value %" PRIu32 "\n", i, elements[i]);
|
|
1180
|
+
* ```
|
|
1181
|
+
*
|
|
1182
|
+
*
|
|
1183
|
+
* Note that the pointer returned by this function is not guaranteed to remain
|
|
1184
|
+
* the same after calls to other JSC API functions. See
|
|
1185
|
+
* jsc_value_array_buffer_get_data() for details.
|
|
1186
|
+
* @returns pointer to memory.
|
|
1187
|
+
*/
|
|
1188
|
+
typed_array_get_data(): [any | null, number];
|
|
1189
|
+
/**
|
|
1190
|
+
* Gets the number of elements in a typed array.
|
|
1191
|
+
* @returns number of elements.
|
|
1192
|
+
*/
|
|
1193
|
+
typed_array_get_length(): number;
|
|
1194
|
+
/**
|
|
1195
|
+
* Gets the offset over the underlying array buffer data.
|
|
1196
|
+
* @returns offset, in bytes.
|
|
1197
|
+
*/
|
|
1198
|
+
typed_array_get_offset(): number;
|
|
1199
|
+
/**
|
|
1200
|
+
* Gets the size of a typed array.
|
|
1201
|
+
* @returns size, in bytes.
|
|
1202
|
+
*/
|
|
1203
|
+
typed_array_get_size(): number;
|
|
1204
|
+
/**
|
|
1205
|
+
* Gets the type of elements contained in a typed array.
|
|
1206
|
+
* @returns type of the elements, or %JSC_TYPED_ARRAY_NONE if @value is not a typed array.
|
|
1207
|
+
*/
|
|
1208
|
+
typed_array_get_type(): TypedArrayType;
|
|
1209
|
+
}
|
|
1513
1210
|
|
|
1514
|
-
|
|
1515
|
-
|
|
1211
|
+
module VirtualMachine {
|
|
1212
|
+
// Constructor properties interface
|
|
1516
1213
|
|
|
1517
|
-
|
|
1214
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {}
|
|
1215
|
+
}
|
|
1518
1216
|
|
|
1519
|
-
constructor(config?: VirtualMachine.ConstructorProperties)
|
|
1520
1217
|
/**
|
|
1521
|
-
*
|
|
1522
|
-
*
|
|
1523
|
-
*
|
|
1218
|
+
* JSCVirtualMachine represents a group of JSCContext<!-- -->s. It allows
|
|
1219
|
+
* concurrent JavaScript execution by creating a different instance of
|
|
1220
|
+
* JSCVirtualMachine in each thread.
|
|
1221
|
+
*
|
|
1222
|
+
* To create a group of JSCContext<!-- -->s pass the same JSCVirtualMachine
|
|
1223
|
+
* instance to every JSCContext constructor.
|
|
1524
1224
|
*/
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
* Create a new #JSCVirtualMachine.
|
|
1528
|
-
* @constructor
|
|
1529
|
-
* @returns the newly created #JSCVirtualMachine.
|
|
1530
|
-
*/
|
|
1531
|
-
static new(): VirtualMachine
|
|
1532
|
-
_init(config?: VirtualMachine.ConstructorProperties): void
|
|
1533
|
-
}
|
|
1225
|
+
class VirtualMachine extends GObject.Object {
|
|
1226
|
+
static $gtype: GObject.GType<VirtualMachine>;
|
|
1534
1227
|
|
|
1535
|
-
|
|
1228
|
+
// Constructors of JavaScriptCore.VirtualMachine
|
|
1536
1229
|
|
|
1537
|
-
|
|
1230
|
+
constructor(properties?: Partial<VirtualMachine.ConstructorProps>, ...args: any[]);
|
|
1538
1231
|
|
|
1539
|
-
|
|
1540
|
-
* Signal callback interface for `cleared`
|
|
1541
|
-
*/
|
|
1542
|
-
interface ClearedSignalCallback {
|
|
1543
|
-
($obj: WeakValue): void
|
|
1544
|
-
}
|
|
1232
|
+
_init(...args: any[]): void;
|
|
1545
1233
|
|
|
1234
|
+
static ['new'](): VirtualMachine;
|
|
1235
|
+
}
|
|
1546
1236
|
|
|
1547
|
-
|
|
1237
|
+
module WeakValue {
|
|
1238
|
+
// Signal callback interfaces
|
|
1548
1239
|
|
|
1549
|
-
|
|
1240
|
+
interface Cleared {
|
|
1241
|
+
(): void;
|
|
1242
|
+
}
|
|
1550
1243
|
|
|
1551
|
-
//
|
|
1244
|
+
// Constructor properties interface
|
|
1552
1245
|
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
value?: Value | null
|
|
1246
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {
|
|
1247
|
+
value: Value;
|
|
1248
|
+
}
|
|
1557
1249
|
}
|
|
1558
1250
|
|
|
1559
|
-
}
|
|
1560
|
-
|
|
1561
|
-
interface WeakValue {
|
|
1562
|
-
|
|
1563
|
-
// Own properties of JavaScriptCore-6.0.JavaScriptCore.WeakValue
|
|
1564
|
-
|
|
1565
1251
|
/**
|
|
1566
|
-
*
|
|
1252
|
+
* JSCWeakValue represents a weak reference to a value in a #JSCContext. It can be used
|
|
1253
|
+
* to keep a reference to a JavaScript value without protecting it from being garbage
|
|
1254
|
+
* collected and without referencing the #JSCContext either.
|
|
1567
1255
|
*/
|
|
1568
|
-
|
|
1256
|
+
class WeakValue extends GObject.Object {
|
|
1257
|
+
static $gtype: GObject.GType<WeakValue>;
|
|
1569
1258
|
|
|
1570
|
-
|
|
1259
|
+
// Own properties of JavaScriptCore.WeakValue
|
|
1571
1260
|
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
get_value(): Value
|
|
1261
|
+
/**
|
|
1262
|
+
* The #JSCValue referencing the JavaScript value.
|
|
1263
|
+
*/
|
|
1264
|
+
set value(val: Value);
|
|
1577
1265
|
|
|
1578
|
-
|
|
1266
|
+
// Constructors of JavaScriptCore.WeakValue
|
|
1579
1267
|
|
|
1580
|
-
|
|
1581
|
-
connect_after(sigName: "cleared", callback: WeakValue.ClearedSignalCallback): number
|
|
1582
|
-
emit(sigName: "cleared", ...args: any[]): void
|
|
1268
|
+
constructor(properties?: Partial<WeakValue.ConstructorProps>, ...args: any[]);
|
|
1583
1269
|
|
|
1584
|
-
|
|
1270
|
+
_init(...args: any[]): void;
|
|
1585
1271
|
|
|
1586
|
-
|
|
1587
|
-
connect_after(sigName: "notify::value", callback: (($obj: WeakValue, pspec: GObject.ParamSpec) => void)): number
|
|
1588
|
-
emit(sigName: "notify::value", ...args: any[]): void
|
|
1589
|
-
connect(sigName: string, callback: (...args: any[]) => void): number
|
|
1590
|
-
connect_after(sigName: string, callback: (...args: any[]) => void): number
|
|
1591
|
-
emit(sigName: string, ...args: any[]): void
|
|
1592
|
-
disconnect(id: number): void
|
|
1593
|
-
}
|
|
1272
|
+
static ['new'](value: Value): WeakValue;
|
|
1594
1273
|
|
|
1595
|
-
|
|
1596
|
-
* JSCWeakValue represents a weak reference to a value in a #JSCContext. It can be used
|
|
1597
|
-
* to keep a reference to a JavaScript value without protecting it from being garbage
|
|
1598
|
-
* collected and without referencing the #JSCContext either.
|
|
1599
|
-
* @class
|
|
1600
|
-
*/
|
|
1601
|
-
class WeakValue extends GObject.Object {
|
|
1274
|
+
// Own signals of JavaScriptCore.WeakValue
|
|
1602
1275
|
|
|
1603
|
-
|
|
1276
|
+
connect(id: string, callback: (...args: any[]) => any): number;
|
|
1277
|
+
connect_after(id: string, callback: (...args: any[]) => any): number;
|
|
1278
|
+
emit(id: string, ...args: any[]): void;
|
|
1279
|
+
connect(signal: 'cleared', callback: (_source: this) => void): number;
|
|
1280
|
+
connect_after(signal: 'cleared', callback: (_source: this) => void): number;
|
|
1281
|
+
emit(signal: 'cleared'): void;
|
|
1604
1282
|
|
|
1605
|
-
|
|
1606
|
-
static $gtype: GObject.GType<WeakValue>
|
|
1283
|
+
// Own methods of JavaScriptCore.WeakValue
|
|
1607
1284
|
|
|
1608
|
-
|
|
1285
|
+
/**
|
|
1286
|
+
* Get a #JSCValue referencing the JavaScript value of `weak_value`.
|
|
1287
|
+
* @returns a new #JSCValue or %NULL if @weak_value was cleared.
|
|
1288
|
+
*/
|
|
1289
|
+
get_value(): Value;
|
|
1290
|
+
}
|
|
1609
1291
|
|
|
1610
|
-
|
|
1292
|
+
type ClassClass = typeof Class;
|
|
1611
1293
|
/**
|
|
1612
|
-
*
|
|
1613
|
-
*
|
|
1614
|
-
*
|
|
1615
|
-
* @returns a new #JSCWeakValue
|
|
1294
|
+
* Virtual table for a JSCClass. This can be optionally used when registering a #JSCClass in a #JSCContext
|
|
1295
|
+
* to provide a custom implementation for the class. All virtual functions are optional and can be set to
|
|
1296
|
+
* %NULL to fallback to the default implementation.
|
|
1616
1297
|
*/
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
* Create a new #JSCWeakValue for the JavaScript value referenced by `value`.
|
|
1620
|
-
* @constructor
|
|
1621
|
-
* @param value a #JSCValue
|
|
1622
|
-
* @returns a new #JSCWeakValue
|
|
1623
|
-
*/
|
|
1624
|
-
static new(value: Value): WeakValue
|
|
1625
|
-
_init(config?: WeakValue.ConstructorProperties): void
|
|
1626
|
-
}
|
|
1627
|
-
|
|
1628
|
-
interface ClassClass {
|
|
1298
|
+
class ClassVTable {
|
|
1299
|
+
static $gtype: GObject.GType<ClassVTable>;
|
|
1629
1300
|
|
|
1630
|
-
|
|
1301
|
+
// Own fields of JavaScriptCore.ClassVTable
|
|
1631
1302
|
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1303
|
+
get_property: ClassGetPropertyFunction;
|
|
1304
|
+
set_property: ClassSetPropertyFunction;
|
|
1305
|
+
has_property: ClassHasPropertyFunction;
|
|
1306
|
+
delete_property: ClassDeletePropertyFunction;
|
|
1307
|
+
enumerate_properties: ClassEnumeratePropertiesFunction;
|
|
1636
1308
|
|
|
1637
|
-
|
|
1309
|
+
// Constructors of JavaScriptCore.ClassVTable
|
|
1638
1310
|
|
|
1639
|
-
|
|
1640
|
-
}
|
|
1641
|
-
|
|
1642
|
-
interface ClassVTable {
|
|
1643
|
-
|
|
1644
|
-
// Own fields of JavaScriptCore-6.0.JavaScriptCore.ClassVTable
|
|
1311
|
+
_init(...args: any[]): void;
|
|
1312
|
+
}
|
|
1645
1313
|
|
|
1314
|
+
type ContextClass = typeof Context;
|
|
1315
|
+
type ExceptionClass = typeof Exception;
|
|
1316
|
+
type ValueClass = typeof Value;
|
|
1317
|
+
type VirtualMachineClass = typeof VirtualMachine;
|
|
1318
|
+
type WeakValueClass = typeof WeakValue;
|
|
1646
1319
|
/**
|
|
1647
|
-
*
|
|
1648
|
-
*
|
|
1649
|
-
*/
|
|
1650
|
-
get_property: ClassGetPropertyFunction
|
|
1651
|
-
/**
|
|
1652
|
-
* a #JSCClassSetPropertyFunction for setting a property.
|
|
1653
|
-
* @field
|
|
1654
|
-
*/
|
|
1655
|
-
set_property: ClassSetPropertyFunction
|
|
1656
|
-
/**
|
|
1657
|
-
* a #JSCClassHasPropertyFunction for querying a property.
|
|
1658
|
-
* @field
|
|
1659
|
-
*/
|
|
1660
|
-
has_property: ClassHasPropertyFunction
|
|
1661
|
-
/**
|
|
1662
|
-
* a #JSCClassDeletePropertyFunction for deleting a property.
|
|
1663
|
-
* @field
|
|
1320
|
+
* Name of the imported GIR library
|
|
1321
|
+
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
|
|
1664
1322
|
*/
|
|
1665
|
-
|
|
1323
|
+
const __name__: string;
|
|
1666
1324
|
/**
|
|
1667
|
-
*
|
|
1668
|
-
*
|
|
1325
|
+
* Version of the imported GIR library
|
|
1326
|
+
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
|
|
1669
1327
|
*/
|
|
1670
|
-
|
|
1671
|
-
}
|
|
1672
|
-
|
|
1673
|
-
/**
|
|
1674
|
-
* Virtual table for a JSCClass. This can be optionally used when registering a #JSCClass in a #JSCContext
|
|
1675
|
-
* to provide a custom implementation for the class. All virtual functions are optional and can be set to
|
|
1676
|
-
* %NULL to fallback to the default implementation.
|
|
1677
|
-
* @record
|
|
1678
|
-
*/
|
|
1679
|
-
class ClassVTable {
|
|
1680
|
-
|
|
1681
|
-
// Own properties of JavaScriptCore-6.0.JavaScriptCore.ClassVTable
|
|
1682
|
-
|
|
1683
|
-
static name: string
|
|
1684
|
-
}
|
|
1685
|
-
|
|
1686
|
-
interface ContextClass {
|
|
1687
|
-
|
|
1688
|
-
// Own fields of JavaScriptCore-6.0.JavaScriptCore.ContextClass
|
|
1689
|
-
|
|
1690
|
-
parent_class: GObject.ObjectClass
|
|
1691
|
-
}
|
|
1692
|
-
|
|
1693
|
-
abstract class ContextClass {
|
|
1694
|
-
|
|
1695
|
-
// Own properties of JavaScriptCore-6.0.JavaScriptCore.ContextClass
|
|
1696
|
-
|
|
1697
|
-
static name: string
|
|
1698
|
-
}
|
|
1699
|
-
|
|
1700
|
-
interface ExceptionClass {
|
|
1701
|
-
|
|
1702
|
-
// Own fields of JavaScriptCore-6.0.JavaScriptCore.ExceptionClass
|
|
1703
|
-
|
|
1704
|
-
parent_class: GObject.ObjectClass
|
|
1705
|
-
}
|
|
1706
|
-
|
|
1707
|
-
abstract class ExceptionClass {
|
|
1708
|
-
|
|
1709
|
-
// Own properties of JavaScriptCore-6.0.JavaScriptCore.ExceptionClass
|
|
1710
|
-
|
|
1711
|
-
static name: string
|
|
1712
|
-
}
|
|
1713
|
-
|
|
1714
|
-
interface ValueClass {
|
|
1715
|
-
|
|
1716
|
-
// Own fields of JavaScriptCore-6.0.JavaScriptCore.ValueClass
|
|
1717
|
-
|
|
1718
|
-
parent_class: GObject.ObjectClass
|
|
1719
|
-
}
|
|
1720
|
-
|
|
1721
|
-
abstract class ValueClass {
|
|
1722
|
-
|
|
1723
|
-
// Own properties of JavaScriptCore-6.0.JavaScriptCore.ValueClass
|
|
1724
|
-
|
|
1725
|
-
static name: string
|
|
1726
|
-
}
|
|
1727
|
-
|
|
1728
|
-
interface VirtualMachineClass {
|
|
1729
|
-
|
|
1730
|
-
// Own fields of JavaScriptCore-6.0.JavaScriptCore.VirtualMachineClass
|
|
1731
|
-
|
|
1732
|
-
parent_class: GObject.ObjectClass
|
|
1733
|
-
}
|
|
1734
|
-
|
|
1735
|
-
abstract class VirtualMachineClass {
|
|
1736
|
-
|
|
1737
|
-
// Own properties of JavaScriptCore-6.0.JavaScriptCore.VirtualMachineClass
|
|
1738
|
-
|
|
1739
|
-
static name: string
|
|
1740
|
-
}
|
|
1741
|
-
|
|
1742
|
-
interface WeakValueClass {
|
|
1743
|
-
|
|
1744
|
-
// Own fields of JavaScriptCore-6.0.JavaScriptCore.WeakValueClass
|
|
1745
|
-
|
|
1746
|
-
parent_class: GObject.ObjectClass
|
|
1747
|
-
}
|
|
1748
|
-
|
|
1749
|
-
abstract class WeakValueClass {
|
|
1750
|
-
|
|
1751
|
-
// Own properties of JavaScriptCore-6.0.JavaScriptCore.WeakValueClass
|
|
1752
|
-
|
|
1753
|
-
static name: string
|
|
1754
|
-
}
|
|
1755
|
-
|
|
1756
|
-
/**
|
|
1757
|
-
* Name of the imported GIR library
|
|
1758
|
-
* @see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
|
|
1759
|
-
*/
|
|
1760
|
-
const __name__: string
|
|
1761
|
-
/**
|
|
1762
|
-
* Version of the imported GIR library
|
|
1763
|
-
* @see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
|
|
1764
|
-
*/
|
|
1765
|
-
const __version__: string
|
|
1328
|
+
const __version__: string;
|
|
1766
1329
|
}
|
|
1767
1330
|
|
|
1768
1331
|
export default JavaScriptCore;
|
|
1769
|
-
// END
|
|
1332
|
+
// END
|