@girs/gjs 3.0.4 → 3.1.0
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 +23 -2
- package/dom.d.ts +307 -0
- package/gjs.d.cts +26 -324
- package/gjs.d.ts +26 -324
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|

|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
GJS TypeScript type definitions for Gjs using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v3.0.
|
|
7
|
+
GJS TypeScript type definitions for Gjs using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v3.1.0.
|
|
8
8
|
|
|
9
9
|
[GJS](https://gitlab.gnome.org/GNOME/gjs) is a JavaScript runtime for the GNOME ecosystem. Using GJS and the type definitions in this NPM package, you can build GTK applications in JavaScript or TypeScript with type checking, better autocompletion and inline documentations.
|
|
10
10
|
|
|
@@ -33,17 +33,37 @@ const Gjs = require('@girs/gjs');
|
|
|
33
33
|
After the import, the global types of GJS are also available:
|
|
34
34
|
|
|
35
35
|
```ts
|
|
36
|
-
|
|
36
|
+
import '@girs/gjs';
|
|
37
|
+
|
|
37
38
|
print('Hello World from print');
|
|
38
39
|
|
|
39
40
|
const ByteArray = imports.byteArray;
|
|
40
41
|
|
|
42
|
+
// And so on...
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Global DOM types
|
|
46
|
+
|
|
47
|
+
Some types that conflict with the DOM are outsourced to allow frameworks like Gjsify to rebuild the DOM API without causing type conflicts.
|
|
48
|
+
But you can easily import them:
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import '@girs/gjs/dom';
|
|
52
|
+
|
|
53
|
+
console.log('Hello World from console');
|
|
54
|
+
|
|
41
55
|
const encoder = new TextEncoder();
|
|
42
56
|
const encoded = encoder.encode('𝓽𝓮𝔁𝓽');
|
|
43
57
|
|
|
58
|
+
setTimeout(() => {
|
|
59
|
+
// ...
|
|
60
|
+
}, 1000);
|
|
61
|
+
|
|
44
62
|
// And so on...
|
|
45
63
|
```
|
|
46
64
|
|
|
65
|
+
To avoid a type conflict with the DOM types it is recommended to either modify your `tsconfig.json` or `jsconfig.json` file to exclude the DOM lib, or to enable the `noLib` property.
|
|
66
|
+
|
|
47
67
|
### Ambient Modules
|
|
48
68
|
|
|
49
69
|
You can import the built in [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) of GJS.
|
|
@@ -81,6 +101,7 @@ These types will then be available to you:
|
|
|
81
101
|
|
|
82
102
|
```ts
|
|
83
103
|
import '@girs/gjs'
|
|
104
|
+
import '@girs/gjs/dom'
|
|
84
105
|
import '@girs/gio-2.0'
|
|
85
106
|
import '@girs/gtk-4.0'
|
|
86
107
|
import '@girs/adw-1'
|
package/dom.d.ts
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gjs has implemented some functionality from the DOM API,
|
|
3
|
+
* this leads to a conflict when all DOM (`lib.dom.d.ts`) should be used.
|
|
4
|
+
* This should normally not be the case, since the other - not yet reimplemented - API's cannot be used in GJS anyway.
|
|
5
|
+
* In particular, Gjsify tries to rebuild the DOM API and therefore does not need these types.
|
|
6
|
+
* For this reason they are stored in this separate file to make them optional.
|
|
7
|
+
*
|
|
8
|
+
* See also https://github.com/microsoft/TypeScript/blob/main/lib/lib.dom.d.ts
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type GLib from '@girs/glib-2.0';
|
|
12
|
+
|
|
13
|
+
declare global {
|
|
14
|
+
|
|
15
|
+
// Timers
|
|
16
|
+
// See https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/esm/_timers.js
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @version Gjs 1.71.1
|
|
20
|
+
* @param callback a callback function
|
|
21
|
+
* @param delay the duration in milliseconds to wait before running callback
|
|
22
|
+
* @param args arguments to pass to callback
|
|
23
|
+
*/
|
|
24
|
+
function setTimeout(callback: (...args: any[]) => any, delay?: number, ...args: any[]): GLib.Source
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @version Gjs 1.71.1
|
|
28
|
+
* @param callback a callback function
|
|
29
|
+
* @param delay the duration in milliseconds to wait between calling callback
|
|
30
|
+
* @param args arguments to pass to callback
|
|
31
|
+
*/
|
|
32
|
+
function setInterval(callback: (...args: any[]) => any, delay?: number, ...args: any[]): GLib.Source
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @version Gjs 1.71.1
|
|
36
|
+
* @param timeout the timeout to clear
|
|
37
|
+
*/
|
|
38
|
+
function clearTimeout(timeout: GLib.Source): void
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @version Gjs 1.71.1
|
|
42
|
+
* @param timeout the timeout to clear
|
|
43
|
+
*/
|
|
44
|
+
function clearInterval(timeout: GLib.Source): void
|
|
45
|
+
|
|
46
|
+
interface Console {
|
|
47
|
+
/**
|
|
48
|
+
* Logs a critical message if the condition is not truthy.
|
|
49
|
+
* {@link console.error()} for additional information.
|
|
50
|
+
*
|
|
51
|
+
* @param condition a boolean condition which, if false, causes
|
|
52
|
+
* the log to print
|
|
53
|
+
* @param data formatting substitutions, if applicable
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
assert(condition: boolean, ...data: any[]): void
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Resets grouping and clears the terminal on systems supporting ANSI
|
|
60
|
+
* terminal control sequences.
|
|
61
|
+
*
|
|
62
|
+
* In file-based stdout or systems which do not support clearing,
|
|
63
|
+
* console.clear() has no visual effect.
|
|
64
|
+
*
|
|
65
|
+
*/
|
|
66
|
+
clear(): void
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Logs a message with severity equal to {@link GLib.LogLevelFlags.DEBUG}.
|
|
70
|
+
*
|
|
71
|
+
* @param {...any} data formatting substitutions, if applicable
|
|
72
|
+
*/
|
|
73
|
+
debug(...data: any[]): void
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Logs a message with severity equal to {@link GLib.LogLevelFlags.CRITICAL}.
|
|
77
|
+
* Does not use {@link GLib.LogLevelFlags.ERROR} to avoid asserting and
|
|
78
|
+
* forcibly shutting down the application.
|
|
79
|
+
*
|
|
80
|
+
* @param data formatting substitutions, if applicable
|
|
81
|
+
*/
|
|
82
|
+
error(...data: any[]): void
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Logs a message with severity equal to {@link GLib.LogLevelFlags.INFO}.
|
|
86
|
+
*
|
|
87
|
+
* @param data formatting substitutions, if applicable
|
|
88
|
+
*/
|
|
89
|
+
info(...data: any[]): void
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Logs a message with severity equal to {@link GLib.LogLevelFlags.MESSAGE}.
|
|
93
|
+
*
|
|
94
|
+
* @param data formatting substitutions, if applicable
|
|
95
|
+
*/
|
|
96
|
+
log(...data: any[]): void
|
|
97
|
+
|
|
98
|
+
// 1.1.7 table(tabularData, properties)
|
|
99
|
+
table(tabularData: any, _properties: never): void
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @param data formatting substitutions, if applicable
|
|
103
|
+
*/
|
|
104
|
+
trace(...data: any[]): void
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @param data formatting substitutions, if applicable
|
|
108
|
+
*/
|
|
109
|
+
warn(...data: any[]): void
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @param item an item to format generically
|
|
113
|
+
* @param [options] any additional options for the formatter. Unused
|
|
114
|
+
* in our implementation.
|
|
115
|
+
*/
|
|
116
|
+
dir(item: object, options: never): void
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @param data formatting substitutions, if applicable
|
|
120
|
+
*/
|
|
121
|
+
dirxml(...data: any[]): void
|
|
122
|
+
|
|
123
|
+
// 1.2 Counting functions
|
|
124
|
+
// https://console.spec.whatwg.org/#counting
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Logs how many times console.count(label) has been called with a given
|
|
128
|
+
* label.
|
|
129
|
+
* {@link console.countReset()} for resetting a count.
|
|
130
|
+
*
|
|
131
|
+
* @param label unique identifier for this action
|
|
132
|
+
*/
|
|
133
|
+
count(label: string): void
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @param label the unique label to reset the count for
|
|
137
|
+
*/
|
|
138
|
+
countReset(label: string): void
|
|
139
|
+
|
|
140
|
+
// 1.3 Grouping functions
|
|
141
|
+
// https://console.spec.whatwg.org/#grouping
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @param data formatting substitutions, if applicable
|
|
145
|
+
*/
|
|
146
|
+
group(...data: any[]): void
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Alias for console.group()
|
|
150
|
+
*
|
|
151
|
+
* @param {...any} data formatting substitutions, if applicable
|
|
152
|
+
*/
|
|
153
|
+
groupCollapsed(...data: any[]): void
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
*/
|
|
157
|
+
groupEnd(): void
|
|
158
|
+
|
|
159
|
+
// 1.4 Timing functions
|
|
160
|
+
// https://console.spec.whatwg.org/#timing
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* @param label unique identifier for this action, pass to
|
|
164
|
+
* console.timeEnd() to complete
|
|
165
|
+
*/
|
|
166
|
+
time(label: string): void
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Logs the time since the last call to console.time(label) where label is
|
|
170
|
+
* the same.
|
|
171
|
+
*
|
|
172
|
+
* @param label unique identifier for this action, pass to
|
|
173
|
+
* console.timeEnd() to complete
|
|
174
|
+
* @param data string substitutions, if applicable
|
|
175
|
+
*/
|
|
176
|
+
timeLog(label: string, ...data: any[]): void
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Logs the time since the last call to console.time(label) and completes
|
|
180
|
+
* the action.
|
|
181
|
+
* Call console.time(label) again to re-measure.
|
|
182
|
+
*
|
|
183
|
+
* @param label unique identifier for this action
|
|
184
|
+
*/
|
|
185
|
+
timeEnd(label: string): void
|
|
186
|
+
|
|
187
|
+
// Non-standard functions which are de-facto standards.
|
|
188
|
+
// Similar to Node, we define these as no-ops for now.
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* @deprecated Not implemented in GJS
|
|
192
|
+
*
|
|
193
|
+
* @param _label unique identifier for this action, pass to
|
|
194
|
+
* console.profileEnd to complete
|
|
195
|
+
*/
|
|
196
|
+
profile(_label: string): void
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* @deprecated Not implemented in GJS
|
|
200
|
+
*
|
|
201
|
+
* @param _label unique identifier for this action
|
|
202
|
+
*/
|
|
203
|
+
profileEnd(_label: string): void
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* @deprecated Not implemented in GJS
|
|
207
|
+
*
|
|
208
|
+
* @param _label unique identifier for this action
|
|
209
|
+
*/
|
|
210
|
+
timeStamp(_label: string): void
|
|
211
|
+
|
|
212
|
+
// GJS-specific extensions for integrating with GLib structured logging
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* @param logDomain the GLib log domain this Console should print
|
|
216
|
+
* with. Defaults to 'Gjs-Console'.
|
|
217
|
+
*/
|
|
218
|
+
setLogDomain(logDomain: string): void
|
|
219
|
+
|
|
220
|
+
logDomain: string
|
|
221
|
+
|
|
222
|
+
interact(): void
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
interface TextDecodeOptions {
|
|
226
|
+
// As of Gjs 1.73.2 stream mode is not supported yet.
|
|
227
|
+
// stream?: boolean
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
interface TextDecoderOptions {
|
|
231
|
+
/** Indicates whether the error mode is fatal. */
|
|
232
|
+
fatal?: boolean
|
|
233
|
+
/** Indicates whether whether the byte order mark is ignored. */
|
|
234
|
+
ignoreBOM?: boolean
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* The TextDecoder interface represents a decoder for a specific text encoding.
|
|
239
|
+
* It takes a stream of bytes as input and emits a stream of code points.
|
|
240
|
+
*
|
|
241
|
+
* @version Gjs 1.69.2
|
|
242
|
+
*/
|
|
243
|
+
interface TextDecoder {
|
|
244
|
+
/** A string containing the name of the decoder, that is a string describing the method the TextDecoder will use. */
|
|
245
|
+
readonly encoding: TextDecoderEncoding
|
|
246
|
+
/** A Boolean indicating whether the error mode is fatal. */
|
|
247
|
+
readonly fatal: boolean
|
|
248
|
+
/** A Boolean indicating whether the byte order mark is ignored. */
|
|
249
|
+
readonly ignoreBOM: boolean
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Returns a string containing the text decoded with the method of the specific TextDecoder object.
|
|
253
|
+
*
|
|
254
|
+
* If the error mode is "fatal" and the encoder method encounter an error it WILL THROW a TypeError.
|
|
255
|
+
*
|
|
256
|
+
* @param input Buffer containing the text to decode
|
|
257
|
+
* @param options Object defining the decode options
|
|
258
|
+
*/
|
|
259
|
+
decode(input?: ArrayBufferView | ArrayBuffer, options?: TextDecodeOptions): string
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
interface TextEncoderEncodeIntoResult {
|
|
263
|
+
read?: number
|
|
264
|
+
written?: number
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* TextEncoder takes a stream of code points as input and emits a stream of bytes.
|
|
269
|
+
*
|
|
270
|
+
* @version Gjs 1.69.2
|
|
271
|
+
*/
|
|
272
|
+
interface TextEncoder {
|
|
273
|
+
readonly encoding: 'utf-8'
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Takes a string as input, and returns a buffer containing the text given in parameters encoded with the UTF-8 method.
|
|
277
|
+
*
|
|
278
|
+
* @param input Text to encode.
|
|
279
|
+
*/
|
|
280
|
+
encode(input?: string): Uint8Array
|
|
281
|
+
/**
|
|
282
|
+
* Takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into,
|
|
283
|
+
* and returns a dictionary object indicating the progress of the encoding.
|
|
284
|
+
*
|
|
285
|
+
* This is potentially more performant than the older encode() method.
|
|
286
|
+
*
|
|
287
|
+
* @param source Text to encode.
|
|
288
|
+
* @param destination Buffer where to place the resulting UTF-8 encoded text into.
|
|
289
|
+
*/
|
|
290
|
+
encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const console: Console
|
|
294
|
+
|
|
295
|
+
const TextDecoder: {
|
|
296
|
+
prototype: TextDecoder
|
|
297
|
+
new (label?: TextDecoderEncoding, options?: TextDecoderOptions): TextDecoder
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
const TextEncoder: {
|
|
301
|
+
prototype: TextEncoder
|
|
302
|
+
new (): TextEncoder
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export {}
|
|
307
|
+
|
package/gjs.d.cts
CHANGED
|
@@ -79,10 +79,6 @@ declare namespace byteArray {
|
|
|
79
79
|
export function fromArray(array: Iterable<number>): ByteArray
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
declare namespace console {
|
|
83
|
-
export function interact(): void
|
|
84
|
-
}
|
|
85
|
-
|
|
86
82
|
declare namespace lang {
|
|
87
83
|
// TODO: There is a lot more in Lang
|
|
88
84
|
export function Class(props: any): void
|
|
@@ -141,7 +137,7 @@ declare namespace mainloop {
|
|
|
141
137
|
export interface SignalMethods {
|
|
142
138
|
/**
|
|
143
139
|
* Connects a callback to a signal for an object. Pass the returned ID to
|
|
144
|
-
* `
|
|
140
|
+
* `disconnect()` to remove the handler.
|
|
145
141
|
*
|
|
146
142
|
* If `callback` returns `true`, emission will stop and no other handlers will be
|
|
147
143
|
* invoked.
|
|
@@ -185,218 +181,8 @@ declare namespace signals {
|
|
|
185
181
|
export function addSignalMethods<T = any>(proto: T): proto is T & SignalMethods;
|
|
186
182
|
}
|
|
187
183
|
|
|
188
|
-
// See also https://github.com/microsoft/TypeScript/blob/main/lib/lib.dom.d.ts
|
|
189
184
|
declare global {
|
|
190
185
|
|
|
191
|
-
interface GjsGiImports {
|
|
192
|
-
// Will be extended by the import of more gir types
|
|
193
|
-
versions: {
|
|
194
|
-
[namespace: string]: string
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
interface GjsImports {
|
|
199
|
-
gi: GjsGiImports
|
|
200
|
-
lang: typeof lang
|
|
201
|
-
system: typeof system
|
|
202
|
-
signals: typeof signals
|
|
203
|
-
package: typeof package
|
|
204
|
-
mainloop: typeof mainloop
|
|
205
|
-
searchPath: string[]
|
|
206
|
-
gettext: typeof gettext
|
|
207
|
-
byteArray: typeof byteArray
|
|
208
|
-
format: typeof format
|
|
209
|
-
cairo: typeof cairo
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
function print(...args: any[]): void
|
|
213
|
-
function printerr(...args: any[]): void
|
|
214
|
-
function log(message: any): void
|
|
215
|
-
function logError(exception: object, message?: any): void
|
|
216
|
-
function logError(message?: any): void
|
|
217
|
-
|
|
218
|
-
const pkg: typeof package
|
|
219
|
-
interface Console {
|
|
220
|
-
/**
|
|
221
|
-
* Logs a critical message if the condition is not truthy.
|
|
222
|
-
* {@link console.error()} for additional information.
|
|
223
|
-
*
|
|
224
|
-
* @param condition a boolean condition which, if false, causes
|
|
225
|
-
* the log to print
|
|
226
|
-
* @param data formatting substitutions, if applicable
|
|
227
|
-
* @returns
|
|
228
|
-
*/
|
|
229
|
-
assert(condition: boolean, ...data: any[]): void
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Resets grouping and clears the terminal on systems supporting ANSI
|
|
233
|
-
* terminal control sequences.
|
|
234
|
-
*
|
|
235
|
-
* In file-based stdout or systems which do not support clearing,
|
|
236
|
-
* console.clear() has no visual effect.
|
|
237
|
-
*
|
|
238
|
-
*/
|
|
239
|
-
clear(): void
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Logs a message with severity equal to {@link GLib.LogLevelFlags.DEBUG}.
|
|
243
|
-
*
|
|
244
|
-
* @param {...any} data formatting substitutions, if applicable
|
|
245
|
-
*/
|
|
246
|
-
debug(...data: any[]): void
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* Logs a message with severity equal to {@link GLib.LogLevelFlags.CRITICAL}.
|
|
250
|
-
* Does not use {@link GLib.LogLevelFlags.ERROR} to avoid asserting and
|
|
251
|
-
* forcibly shutting down the application.
|
|
252
|
-
*
|
|
253
|
-
* @param data formatting substitutions, if applicable
|
|
254
|
-
*/
|
|
255
|
-
error(...data: any[]): void
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Logs a message with severity equal to {@link GLib.LogLevelFlags.INFO}.
|
|
259
|
-
*
|
|
260
|
-
* @param data formatting substitutions, if applicable
|
|
261
|
-
*/
|
|
262
|
-
info(...data: any[]): void
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Logs a message with severity equal to {@link GLib.LogLevelFlags.MESSAGE}.
|
|
266
|
-
*
|
|
267
|
-
* @param data formatting substitutions, if applicable
|
|
268
|
-
*/
|
|
269
|
-
log(...data: any[]): void
|
|
270
|
-
|
|
271
|
-
// 1.1.7 table(tabularData, properties)
|
|
272
|
-
table(tabularData: any, _properties: never): void
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* @param data formatting substitutions, if applicable
|
|
276
|
-
*/
|
|
277
|
-
trace(...data: any[]): void
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* @param data formatting substitutions, if applicable
|
|
281
|
-
*/
|
|
282
|
-
warn(...data: any[]): void
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* @param item an item to format generically
|
|
286
|
-
* @param [options] any additional options for the formatter. Unused
|
|
287
|
-
* in our implementation.
|
|
288
|
-
*/
|
|
289
|
-
dir(item: object, options: never): void
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* @param data formatting substitutions, if applicable
|
|
293
|
-
*/
|
|
294
|
-
dirxml(...data: any[]): void
|
|
295
|
-
|
|
296
|
-
// 1.2 Counting functions
|
|
297
|
-
// https://console.spec.whatwg.org/#counting
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Logs how many times console.count(label) has been called with a given
|
|
301
|
-
* label.
|
|
302
|
-
* {@link console.countReset()} for resetting a count.
|
|
303
|
-
*
|
|
304
|
-
* @param label unique identifier for this action
|
|
305
|
-
*/
|
|
306
|
-
count(label: string): void
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* @param label the unique label to reset the count for
|
|
310
|
-
*/
|
|
311
|
-
countReset(label: string): void
|
|
312
|
-
|
|
313
|
-
// 1.3 Grouping functions
|
|
314
|
-
// https://console.spec.whatwg.org/#grouping
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* @param data formatting substitutions, if applicable
|
|
318
|
-
*/
|
|
319
|
-
group(...data: any[]): void
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* Alias for console.group()
|
|
323
|
-
*
|
|
324
|
-
* @param {...any} data formatting substitutions, if applicable
|
|
325
|
-
*/
|
|
326
|
-
groupCollapsed(...data: any[]): void
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
*/
|
|
330
|
-
groupEnd(): void
|
|
331
|
-
|
|
332
|
-
// 1.4 Timing functions
|
|
333
|
-
// https://console.spec.whatwg.org/#timing
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* @param label unique identifier for this action, pass to
|
|
337
|
-
* console.timeEnd() to complete
|
|
338
|
-
*/
|
|
339
|
-
time(label: string): void
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* Logs the time since the last call to console.time(label) where label is
|
|
343
|
-
* the same.
|
|
344
|
-
*
|
|
345
|
-
* @param label unique identifier for this action, pass to
|
|
346
|
-
* console.timeEnd() to complete
|
|
347
|
-
* @param data string substitutions, if applicable
|
|
348
|
-
*/
|
|
349
|
-
timeLog(label: string, ...data: any[]): void
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* Logs the time since the last call to console.time(label) and completes
|
|
353
|
-
* the action.
|
|
354
|
-
* Call console.time(label) again to re-measure.
|
|
355
|
-
*
|
|
356
|
-
* @param label unique identifier for this action
|
|
357
|
-
*/
|
|
358
|
-
timeEnd(label: string): void
|
|
359
|
-
|
|
360
|
-
// Non-standard functions which are de-facto standards.
|
|
361
|
-
// Similar to Node, we define these as no-ops for now.
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* @deprecated Not implemented in GJS
|
|
365
|
-
*
|
|
366
|
-
* @param _label unique identifier for this action, pass to
|
|
367
|
-
* console.profileEnd to complete
|
|
368
|
-
*/
|
|
369
|
-
profile(_label: string): void
|
|
370
|
-
|
|
371
|
-
/**
|
|
372
|
-
* @deprecated Not implemented in GJS
|
|
373
|
-
*
|
|
374
|
-
* @param _label unique identifier for this action
|
|
375
|
-
*/
|
|
376
|
-
profileEnd(_label: string): void
|
|
377
|
-
|
|
378
|
-
/**
|
|
379
|
-
* @deprecated Not implemented in GJS
|
|
380
|
-
*
|
|
381
|
-
* @param _label unique identifier for this action
|
|
382
|
-
*/
|
|
383
|
-
timeStamp(_label: string): void
|
|
384
|
-
|
|
385
|
-
// GJS-specific extensions for integrating with GLib structured logging
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* @param logDomain the GLib log domain this Console should print
|
|
389
|
-
* with. Defaults to 'Gjs-Console'.
|
|
390
|
-
*/
|
|
391
|
-
setLogDomain(logDomain: string): void
|
|
392
|
-
|
|
393
|
-
logDomain: string
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
const console: Console
|
|
398
|
-
|
|
399
|
-
|
|
400
186
|
// https://gitlab.gnome.org/GNOME/gjs/-/blob/1.73.2/modules/esm/_encoding/encodingMap.js#L7-232
|
|
401
187
|
type TextDecoderEncoding =
|
|
402
188
|
| 'unicode-1-1-utf-8'
|
|
@@ -620,87 +406,34 @@ declare global {
|
|
|
620
406
|
| 'utf-16'
|
|
621
407
|
| 'utf-16le'
|
|
622
408
|
|
|
623
|
-
interface
|
|
624
|
-
//
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
interface TextDecoderOptions {
|
|
629
|
-
/** Indicates whether the error mode is fatal. */
|
|
630
|
-
fatal?: boolean
|
|
631
|
-
/** Indicates whether whether the byte order mark is ignored. */
|
|
632
|
-
ignoreBOM?: boolean
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
/**
|
|
636
|
-
* The TextDecoder interface represents a decoder for a specific text encoding.
|
|
637
|
-
* It takes a stream of bytes as input and emits a stream of code points.
|
|
638
|
-
*
|
|
639
|
-
* @version Gjs 1.69.2
|
|
640
|
-
*/
|
|
641
|
-
interface TextDecoder {
|
|
642
|
-
/** A string containing the name of the decoder, that is a string describing the method the TextDecoder will use. */
|
|
643
|
-
readonly encoding: TextDecoderEncoding
|
|
644
|
-
/** A Boolean indicating whether the error mode is fatal. */
|
|
645
|
-
readonly fatal: boolean
|
|
646
|
-
/** A Boolean indicating whether the byte order mark is ignored. */
|
|
647
|
-
readonly ignoreBOM: boolean
|
|
648
|
-
|
|
649
|
-
/**
|
|
650
|
-
* Returns a string containing the text decoded with the method of the specific TextDecoder object.
|
|
651
|
-
*
|
|
652
|
-
* If the error mode is "fatal" and the encoder method encounter an error it WILL THROW a TypeError.
|
|
653
|
-
*
|
|
654
|
-
* @param input Buffer containing the text to decode
|
|
655
|
-
* @param options Object defining the decode options
|
|
656
|
-
*/
|
|
657
|
-
decode(input?: ArrayBufferView | ArrayBuffer, options?: TextDecodeOptions): string
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
const TextDecoder: {
|
|
662
|
-
prototype: TextDecoder
|
|
663
|
-
new (label?: TextDecoderEncoding, options?: TextDecoderOptions): TextDecoder
|
|
409
|
+
interface GjsGiImports {
|
|
410
|
+
// Will be extended by the import of more gir types
|
|
411
|
+
versions: {
|
|
412
|
+
[namespace: string]: string
|
|
413
|
+
}
|
|
664
414
|
}
|
|
665
415
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
416
|
+
interface GjsImports {
|
|
417
|
+
gi: GjsGiImports
|
|
418
|
+
lang: typeof lang
|
|
419
|
+
system: typeof system
|
|
420
|
+
signals: typeof signals
|
|
421
|
+
package: typeof package
|
|
422
|
+
mainloop: typeof mainloop
|
|
423
|
+
searchPath: string[]
|
|
424
|
+
gettext: typeof gettext
|
|
425
|
+
byteArray: typeof byteArray
|
|
426
|
+
format: typeof format
|
|
427
|
+
cairo: typeof cairo
|
|
670
428
|
}
|
|
671
429
|
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
interface TextEncoder {
|
|
678
|
-
readonly encoding: 'utf-8'
|
|
679
|
-
|
|
680
|
-
/**
|
|
681
|
-
* Takes a string as input, and returns a buffer containing the text given in parameters encoded with the UTF-8 method.
|
|
682
|
-
*
|
|
683
|
-
* @param input Text to encode.
|
|
684
|
-
*/
|
|
685
|
-
encode(input?: string): Uint8Array
|
|
686
|
-
/**
|
|
687
|
-
* Takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into,
|
|
688
|
-
* and returns a dictionary object indicating the progress of the encoding.
|
|
689
|
-
*
|
|
690
|
-
* This is potentially more performant than the older encode() method.
|
|
691
|
-
*
|
|
692
|
-
* @param source Text to encode.
|
|
693
|
-
* @param destination Buffer where to place the resulting UTF-8 encoded text into.
|
|
694
|
-
*/
|
|
695
|
-
encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult
|
|
696
|
-
}
|
|
430
|
+
function print(...args: any[]): void
|
|
431
|
+
function printerr(...args: any[]): void
|
|
432
|
+
function log(message: any): void
|
|
433
|
+
function logError(exception: object, message?: any): void
|
|
434
|
+
function logError(message?: any): void
|
|
697
435
|
|
|
698
|
-
|
|
699
|
-
const TextEncoder: {
|
|
700
|
-
prototype: TextEncoder
|
|
701
|
-
new (): TextEncoder
|
|
702
|
-
}
|
|
703
|
-
|
|
436
|
+
const pkg: typeof package
|
|
704
437
|
|
|
705
438
|
interface BooleanConstructor {
|
|
706
439
|
$gtype: GObject.GType<boolean>
|
|
@@ -714,40 +447,9 @@ declare global {
|
|
|
714
447
|
$gtype: GObject.GType<string>
|
|
715
448
|
}
|
|
716
449
|
|
|
717
|
-
const ARGV: string[]
|
|
718
|
-
|
|
719
|
-
// Timers
|
|
720
|
-
// See https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/esm/_timers.js
|
|
721
|
-
|
|
722
|
-
/**
|
|
723
|
-
* @version Gjs 1.71.1
|
|
724
|
-
* @param callback a callback function
|
|
725
|
-
* @param delay the duration in milliseconds to wait before running callback
|
|
726
|
-
* @param args arguments to pass to callback
|
|
727
|
-
*/
|
|
728
|
-
function setTimeout(callback: (...args: any[]) => any, delay?: number, ...args: any[]): GLib.Source
|
|
729
|
-
|
|
730
|
-
/**
|
|
731
|
-
* @version Gjs 1.71.1
|
|
732
|
-
* @param callback a callback function
|
|
733
|
-
* @param delay the duration in milliseconds to wait between calling callback
|
|
734
|
-
* @param args arguments to pass to callback
|
|
735
|
-
*/
|
|
736
|
-
function setInterval(callback: (...args: any[]) => any, delay?: number, ...args: any[]): GLib.Source
|
|
737
|
-
|
|
738
|
-
/**
|
|
739
|
-
* @version Gjs 1.71.1
|
|
740
|
-
* @param timeout the timeout to clear
|
|
741
|
-
*/
|
|
742
|
-
function clearTimeout(timeout: GLib.Source): void
|
|
743
|
-
|
|
744
|
-
/**
|
|
745
|
-
* @version Gjs 1.71.1
|
|
746
|
-
* @param timeout the timeout to clear
|
|
747
|
-
*/
|
|
748
|
-
function clearInterval(timeout: GLib.Source): void
|
|
749
|
-
|
|
750
450
|
const imports: GjsImports
|
|
451
|
+
|
|
452
|
+
const ARGV: string[]
|
|
751
453
|
}
|
|
752
454
|
|
|
753
455
|
declare const _imports: GjsImports
|
package/gjs.d.ts
CHANGED
|
@@ -79,10 +79,6 @@ declare namespace byteArray {
|
|
|
79
79
|
export function fromArray(array: Iterable<number>): ByteArray
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
declare namespace console {
|
|
83
|
-
export function interact(): void
|
|
84
|
-
}
|
|
85
|
-
|
|
86
82
|
declare namespace lang {
|
|
87
83
|
// TODO: There is a lot more in Lang
|
|
88
84
|
export function Class(props: any): void
|
|
@@ -141,7 +137,7 @@ declare namespace mainloop {
|
|
|
141
137
|
export interface SignalMethods {
|
|
142
138
|
/**
|
|
143
139
|
* Connects a callback to a signal for an object. Pass the returned ID to
|
|
144
|
-
* `
|
|
140
|
+
* `disconnect()` to remove the handler.
|
|
145
141
|
*
|
|
146
142
|
* If `callback` returns `true`, emission will stop and no other handlers will be
|
|
147
143
|
* invoked.
|
|
@@ -185,218 +181,8 @@ declare namespace signals {
|
|
|
185
181
|
export function addSignalMethods<T = any>(proto: T): proto is T & SignalMethods;
|
|
186
182
|
}
|
|
187
183
|
|
|
188
|
-
// See also https://github.com/microsoft/TypeScript/blob/main/lib/lib.dom.d.ts
|
|
189
184
|
declare global {
|
|
190
185
|
|
|
191
|
-
interface GjsGiImports {
|
|
192
|
-
// Will be extended by the import of more gir types
|
|
193
|
-
versions: {
|
|
194
|
-
[namespace: string]: string
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
interface GjsImports {
|
|
199
|
-
gi: GjsGiImports
|
|
200
|
-
lang: typeof lang
|
|
201
|
-
system: typeof system
|
|
202
|
-
signals: typeof signals
|
|
203
|
-
package: typeof package
|
|
204
|
-
mainloop: typeof mainloop
|
|
205
|
-
searchPath: string[]
|
|
206
|
-
gettext: typeof gettext
|
|
207
|
-
byteArray: typeof byteArray
|
|
208
|
-
format: typeof format
|
|
209
|
-
cairo: typeof cairo
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
function print(...args: any[]): void
|
|
213
|
-
function printerr(...args: any[]): void
|
|
214
|
-
function log(message: any): void
|
|
215
|
-
function logError(exception: object, message?: any): void
|
|
216
|
-
function logError(message?: any): void
|
|
217
|
-
|
|
218
|
-
const pkg: typeof package
|
|
219
|
-
interface Console {
|
|
220
|
-
/**
|
|
221
|
-
* Logs a critical message if the condition is not truthy.
|
|
222
|
-
* {@link console.error()} for additional information.
|
|
223
|
-
*
|
|
224
|
-
* @param condition a boolean condition which, if false, causes
|
|
225
|
-
* the log to print
|
|
226
|
-
* @param data formatting substitutions, if applicable
|
|
227
|
-
* @returns
|
|
228
|
-
*/
|
|
229
|
-
assert(condition: boolean, ...data: any[]): void
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Resets grouping and clears the terminal on systems supporting ANSI
|
|
233
|
-
* terminal control sequences.
|
|
234
|
-
*
|
|
235
|
-
* In file-based stdout or systems which do not support clearing,
|
|
236
|
-
* console.clear() has no visual effect.
|
|
237
|
-
*
|
|
238
|
-
*/
|
|
239
|
-
clear(): void
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Logs a message with severity equal to {@link GLib.LogLevelFlags.DEBUG}.
|
|
243
|
-
*
|
|
244
|
-
* @param {...any} data formatting substitutions, if applicable
|
|
245
|
-
*/
|
|
246
|
-
debug(...data: any[]): void
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* Logs a message with severity equal to {@link GLib.LogLevelFlags.CRITICAL}.
|
|
250
|
-
* Does not use {@link GLib.LogLevelFlags.ERROR} to avoid asserting and
|
|
251
|
-
* forcibly shutting down the application.
|
|
252
|
-
*
|
|
253
|
-
* @param data formatting substitutions, if applicable
|
|
254
|
-
*/
|
|
255
|
-
error(...data: any[]): void
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Logs a message with severity equal to {@link GLib.LogLevelFlags.INFO}.
|
|
259
|
-
*
|
|
260
|
-
* @param data formatting substitutions, if applicable
|
|
261
|
-
*/
|
|
262
|
-
info(...data: any[]): void
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Logs a message with severity equal to {@link GLib.LogLevelFlags.MESSAGE}.
|
|
266
|
-
*
|
|
267
|
-
* @param data formatting substitutions, if applicable
|
|
268
|
-
*/
|
|
269
|
-
log(...data: any[]): void
|
|
270
|
-
|
|
271
|
-
// 1.1.7 table(tabularData, properties)
|
|
272
|
-
table(tabularData: any, _properties: never): void
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* @param data formatting substitutions, if applicable
|
|
276
|
-
*/
|
|
277
|
-
trace(...data: any[]): void
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* @param data formatting substitutions, if applicable
|
|
281
|
-
*/
|
|
282
|
-
warn(...data: any[]): void
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* @param item an item to format generically
|
|
286
|
-
* @param [options] any additional options for the formatter. Unused
|
|
287
|
-
* in our implementation.
|
|
288
|
-
*/
|
|
289
|
-
dir(item: object, options: never): void
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* @param data formatting substitutions, if applicable
|
|
293
|
-
*/
|
|
294
|
-
dirxml(...data: any[]): void
|
|
295
|
-
|
|
296
|
-
// 1.2 Counting functions
|
|
297
|
-
// https://console.spec.whatwg.org/#counting
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Logs how many times console.count(label) has been called with a given
|
|
301
|
-
* label.
|
|
302
|
-
* {@link console.countReset()} for resetting a count.
|
|
303
|
-
*
|
|
304
|
-
* @param label unique identifier for this action
|
|
305
|
-
*/
|
|
306
|
-
count(label: string): void
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* @param label the unique label to reset the count for
|
|
310
|
-
*/
|
|
311
|
-
countReset(label: string): void
|
|
312
|
-
|
|
313
|
-
// 1.3 Grouping functions
|
|
314
|
-
// https://console.spec.whatwg.org/#grouping
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* @param data formatting substitutions, if applicable
|
|
318
|
-
*/
|
|
319
|
-
group(...data: any[]): void
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* Alias for console.group()
|
|
323
|
-
*
|
|
324
|
-
* @param {...any} data formatting substitutions, if applicable
|
|
325
|
-
*/
|
|
326
|
-
groupCollapsed(...data: any[]): void
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
*/
|
|
330
|
-
groupEnd(): void
|
|
331
|
-
|
|
332
|
-
// 1.4 Timing functions
|
|
333
|
-
// https://console.spec.whatwg.org/#timing
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* @param label unique identifier for this action, pass to
|
|
337
|
-
* console.timeEnd() to complete
|
|
338
|
-
*/
|
|
339
|
-
time(label: string): void
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* Logs the time since the last call to console.time(label) where label is
|
|
343
|
-
* the same.
|
|
344
|
-
*
|
|
345
|
-
* @param label unique identifier for this action, pass to
|
|
346
|
-
* console.timeEnd() to complete
|
|
347
|
-
* @param data string substitutions, if applicable
|
|
348
|
-
*/
|
|
349
|
-
timeLog(label: string, ...data: any[]): void
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* Logs the time since the last call to console.time(label) and completes
|
|
353
|
-
* the action.
|
|
354
|
-
* Call console.time(label) again to re-measure.
|
|
355
|
-
*
|
|
356
|
-
* @param label unique identifier for this action
|
|
357
|
-
*/
|
|
358
|
-
timeEnd(label: string): void
|
|
359
|
-
|
|
360
|
-
// Non-standard functions which are de-facto standards.
|
|
361
|
-
// Similar to Node, we define these as no-ops for now.
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* @deprecated Not implemented in GJS
|
|
365
|
-
*
|
|
366
|
-
* @param _label unique identifier for this action, pass to
|
|
367
|
-
* console.profileEnd to complete
|
|
368
|
-
*/
|
|
369
|
-
profile(_label: string): void
|
|
370
|
-
|
|
371
|
-
/**
|
|
372
|
-
* @deprecated Not implemented in GJS
|
|
373
|
-
*
|
|
374
|
-
* @param _label unique identifier for this action
|
|
375
|
-
*/
|
|
376
|
-
profileEnd(_label: string): void
|
|
377
|
-
|
|
378
|
-
/**
|
|
379
|
-
* @deprecated Not implemented in GJS
|
|
380
|
-
*
|
|
381
|
-
* @param _label unique identifier for this action
|
|
382
|
-
*/
|
|
383
|
-
timeStamp(_label: string): void
|
|
384
|
-
|
|
385
|
-
// GJS-specific extensions for integrating with GLib structured logging
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* @param logDomain the GLib log domain this Console should print
|
|
389
|
-
* with. Defaults to 'Gjs-Console'.
|
|
390
|
-
*/
|
|
391
|
-
setLogDomain(logDomain: string): void
|
|
392
|
-
|
|
393
|
-
logDomain: string
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
const console: Console
|
|
398
|
-
|
|
399
|
-
|
|
400
186
|
// https://gitlab.gnome.org/GNOME/gjs/-/blob/1.73.2/modules/esm/_encoding/encodingMap.js#L7-232
|
|
401
187
|
type TextDecoderEncoding =
|
|
402
188
|
| 'unicode-1-1-utf-8'
|
|
@@ -620,87 +406,34 @@ declare global {
|
|
|
620
406
|
| 'utf-16'
|
|
621
407
|
| 'utf-16le'
|
|
622
408
|
|
|
623
|
-
interface
|
|
624
|
-
//
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
interface TextDecoderOptions {
|
|
629
|
-
/** Indicates whether the error mode is fatal. */
|
|
630
|
-
fatal?: boolean
|
|
631
|
-
/** Indicates whether whether the byte order mark is ignored. */
|
|
632
|
-
ignoreBOM?: boolean
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
/**
|
|
636
|
-
* The TextDecoder interface represents a decoder for a specific text encoding.
|
|
637
|
-
* It takes a stream of bytes as input and emits a stream of code points.
|
|
638
|
-
*
|
|
639
|
-
* @version Gjs 1.69.2
|
|
640
|
-
*/
|
|
641
|
-
interface TextDecoder {
|
|
642
|
-
/** A string containing the name of the decoder, that is a string describing the method the TextDecoder will use. */
|
|
643
|
-
readonly encoding: TextDecoderEncoding
|
|
644
|
-
/** A Boolean indicating whether the error mode is fatal. */
|
|
645
|
-
readonly fatal: boolean
|
|
646
|
-
/** A Boolean indicating whether the byte order mark is ignored. */
|
|
647
|
-
readonly ignoreBOM: boolean
|
|
648
|
-
|
|
649
|
-
/**
|
|
650
|
-
* Returns a string containing the text decoded with the method of the specific TextDecoder object.
|
|
651
|
-
*
|
|
652
|
-
* If the error mode is "fatal" and the encoder method encounter an error it WILL THROW a TypeError.
|
|
653
|
-
*
|
|
654
|
-
* @param input Buffer containing the text to decode
|
|
655
|
-
* @param options Object defining the decode options
|
|
656
|
-
*/
|
|
657
|
-
decode(input?: ArrayBufferView | ArrayBuffer, options?: TextDecodeOptions): string
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
const TextDecoder: {
|
|
662
|
-
prototype: TextDecoder
|
|
663
|
-
new (label?: TextDecoderEncoding, options?: TextDecoderOptions): TextDecoder
|
|
409
|
+
interface GjsGiImports {
|
|
410
|
+
// Will be extended by the import of more gir types
|
|
411
|
+
versions: {
|
|
412
|
+
[namespace: string]: string
|
|
413
|
+
}
|
|
664
414
|
}
|
|
665
415
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
416
|
+
interface GjsImports {
|
|
417
|
+
gi: GjsGiImports
|
|
418
|
+
lang: typeof lang
|
|
419
|
+
system: typeof system
|
|
420
|
+
signals: typeof signals
|
|
421
|
+
package: typeof package
|
|
422
|
+
mainloop: typeof mainloop
|
|
423
|
+
searchPath: string[]
|
|
424
|
+
gettext: typeof gettext
|
|
425
|
+
byteArray: typeof byteArray
|
|
426
|
+
format: typeof format
|
|
427
|
+
cairo: typeof cairo
|
|
670
428
|
}
|
|
671
429
|
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
interface TextEncoder {
|
|
678
|
-
readonly encoding: 'utf-8'
|
|
679
|
-
|
|
680
|
-
/**
|
|
681
|
-
* Takes a string as input, and returns a buffer containing the text given in parameters encoded with the UTF-8 method.
|
|
682
|
-
*
|
|
683
|
-
* @param input Text to encode.
|
|
684
|
-
*/
|
|
685
|
-
encode(input?: string): Uint8Array
|
|
686
|
-
/**
|
|
687
|
-
* Takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into,
|
|
688
|
-
* and returns a dictionary object indicating the progress of the encoding.
|
|
689
|
-
*
|
|
690
|
-
* This is potentially more performant than the older encode() method.
|
|
691
|
-
*
|
|
692
|
-
* @param source Text to encode.
|
|
693
|
-
* @param destination Buffer where to place the resulting UTF-8 encoded text into.
|
|
694
|
-
*/
|
|
695
|
-
encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult
|
|
696
|
-
}
|
|
430
|
+
function print(...args: any[]): void
|
|
431
|
+
function printerr(...args: any[]): void
|
|
432
|
+
function log(message: any): void
|
|
433
|
+
function logError(exception: object, message?: any): void
|
|
434
|
+
function logError(message?: any): void
|
|
697
435
|
|
|
698
|
-
|
|
699
|
-
const TextEncoder: {
|
|
700
|
-
prototype: TextEncoder
|
|
701
|
-
new (): TextEncoder
|
|
702
|
-
}
|
|
703
|
-
|
|
436
|
+
const pkg: typeof package
|
|
704
437
|
|
|
705
438
|
interface BooleanConstructor {
|
|
706
439
|
$gtype: GObject.GType<boolean>
|
|
@@ -714,40 +447,9 @@ declare global {
|
|
|
714
447
|
$gtype: GObject.GType<string>
|
|
715
448
|
}
|
|
716
449
|
|
|
717
|
-
const ARGV: string[]
|
|
718
|
-
|
|
719
|
-
// Timers
|
|
720
|
-
// See https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/esm/_timers.js
|
|
721
|
-
|
|
722
|
-
/**
|
|
723
|
-
* @version Gjs 1.71.1
|
|
724
|
-
* @param callback a callback function
|
|
725
|
-
* @param delay the duration in milliseconds to wait before running callback
|
|
726
|
-
* @param args arguments to pass to callback
|
|
727
|
-
*/
|
|
728
|
-
function setTimeout(callback: (...args: any[]) => any, delay?: number, ...args: any[]): GLib.Source
|
|
729
|
-
|
|
730
|
-
/**
|
|
731
|
-
* @version Gjs 1.71.1
|
|
732
|
-
* @param callback a callback function
|
|
733
|
-
* @param delay the duration in milliseconds to wait between calling callback
|
|
734
|
-
* @param args arguments to pass to callback
|
|
735
|
-
*/
|
|
736
|
-
function setInterval(callback: (...args: any[]) => any, delay?: number, ...args: any[]): GLib.Source
|
|
737
|
-
|
|
738
|
-
/**
|
|
739
|
-
* @version Gjs 1.71.1
|
|
740
|
-
* @param timeout the timeout to clear
|
|
741
|
-
*/
|
|
742
|
-
function clearTimeout(timeout: GLib.Source): void
|
|
743
|
-
|
|
744
|
-
/**
|
|
745
|
-
* @version Gjs 1.71.1
|
|
746
|
-
* @param timeout the timeout to clear
|
|
747
|
-
*/
|
|
748
|
-
function clearInterval(timeout: GLib.Source): void
|
|
749
|
-
|
|
750
450
|
const imports: GjsImports
|
|
451
|
+
|
|
452
|
+
const ARGV: string[]
|
|
751
453
|
}
|
|
752
454
|
|
|
753
455
|
declare const _imports: GjsImports
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@girs/gjs",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "GJS TypeScript type definitions for Gjs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "gjs.js",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"default": "./cairo.cjs"
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
+
"./dom": "./dom.d.ts",
|
|
46
47
|
".": {
|
|
47
48
|
"import": {
|
|
48
49
|
"types": "./gjs.d.ts",
|
|
@@ -56,12 +57,12 @@
|
|
|
56
57
|
},
|
|
57
58
|
"scripts": {
|
|
58
59
|
"test": "yarn test:esm && yarn test:cjs",
|
|
59
|
-
"test:esm": "tsc --noEmit gjs.d.ts",
|
|
60
|
-
"test:cjs": "tsc --noEmit gjs.d.cts"
|
|
60
|
+
"test:esm": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit gjs.d.ts",
|
|
61
|
+
"test:cjs": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit gjs.d.cts"
|
|
61
62
|
},
|
|
62
63
|
"dependencies": {
|
|
63
|
-
"@girs/glib-2.0": "^2.76.1-3.0
|
|
64
|
-
"@girs/gobject-2.0": "^2.76.1-3.0
|
|
64
|
+
"@girs/glib-2.0": "^2.76.1-3.1.0",
|
|
65
|
+
"@girs/gobject-2.0": "^2.76.1-3.1.0"
|
|
65
66
|
},
|
|
66
67
|
"devDependencies": {
|
|
67
68
|
"typescript": "*"
|