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