@ts-for-gir/lib 3.0.0 → 3.0.2

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.
Files changed (103) hide show
  1. package/lib/constants.d.ts +9 -1
  2. package/lib/constants.js +4 -1
  3. package/lib/constants.js.map +1 -1
  4. package/lib/dependency-manager.d.ts +11 -0
  5. package/lib/dependency-manager.js +28 -14
  6. package/lib/dependency-manager.js.map +1 -1
  7. package/lib/gir-module.js +2 -3
  8. package/lib/gir-module.js.map +1 -1
  9. package/lib/index.d.ts +0 -3
  10. package/lib/index.js +0 -3
  11. package/lib/index.js.map +1 -1
  12. package/lib/symtable.js +1 -2
  13. package/lib/symtable.js.map +1 -1
  14. package/lib/types/generate-config.d.ts +2 -0
  15. package/lib/types/user-config.d.ts +2 -0
  16. package/lib/utils.d.ts +6 -0
  17. package/lib/utils.js +10 -0
  18. package/lib/utils.js.map +1 -1
  19. package/package.json +9 -10
  20. package/lib/injection/classes/GLib-2-0.d.ts +0 -2
  21. package/lib/injection/classes/GLib-2-0.js +0 -35
  22. package/lib/injection/classes/GLib-2-0.js.map +0 -1
  23. package/lib/injection/classes/gjs/GLib-2.0.d.ts +0 -2
  24. package/lib/injection/classes/gjs/GLib-2.0.js +0 -205
  25. package/lib/injection/classes/gjs/GLib-2.0.js.map +0 -1
  26. package/lib/injection/classes/gjs/GObject-2.0.d.ts +0 -2
  27. package/lib/injection/classes/gjs/GObject-2.0.js +0 -634
  28. package/lib/injection/classes/gjs/GObject-2.0.js.map +0 -1
  29. package/lib/injection/classes/gjs/Gio-2.0.d.ts +0 -5
  30. package/lib/injection/classes/gjs/Gio-2.0.js +0 -218
  31. package/lib/injection/classes/gjs/Gio-2.0.js.map +0 -1
  32. package/lib/injection/classes/node-gtk/GLib-2.0.d.ts +0 -2
  33. package/lib/injection/classes/node-gtk/GLib-2.0.js +0 -19
  34. package/lib/injection/classes/node-gtk/GLib-2.0.js.map +0 -1
  35. package/lib/injection/classes/node-gtk/GObject-2.0.d.ts +0 -2
  36. package/lib/injection/classes/node-gtk/GObject-2.0.js +0 -66
  37. package/lib/injection/classes/node-gtk/GObject-2.0.js.map +0 -1
  38. package/lib/injection/classes/node-gtk/Gdk-4.0.d.ts +0 -2
  39. package/lib/injection/classes/node-gtk/Gdk-4.0.js +0 -32
  40. package/lib/injection/classes/node-gtk/Gdk-4.0.js.map +0 -1
  41. package/lib/injection/classes/node-gtk/Gio-2.0.d.ts +0 -2
  42. package/lib/injection/classes/node-gtk/Gio-2.0.js +0 -14
  43. package/lib/injection/classes/node-gtk/Gio-2.0.js.map +0 -1
  44. package/lib/injection/classes/node-gtk/Graphene-1.0.d.ts +0 -2
  45. package/lib/injection/classes/node-gtk/Graphene-1.0.js +0 -133
  46. package/lib/injection/classes/node-gtk/Graphene-1.0.js.map +0 -1
  47. package/lib/injection/classes/node-gtk/Gtk-3.0.d.ts +0 -2
  48. package/lib/injection/classes/node-gtk/Gtk-3.0.js +0 -31
  49. package/lib/injection/classes/node-gtk/Gtk-3.0.js.map +0 -1
  50. package/lib/injection/classes/node-gtk/Gtk-4.0.d.ts +0 -2
  51. package/lib/injection/classes/node-gtk/Gtk-4.0.js +0 -52
  52. package/lib/injection/classes/node-gtk/Gtk-4.0.js.map +0 -1
  53. package/lib/injection/classes/node-gtk/Pango-1.0.d.ts +0 -2
  54. package/lib/injection/classes/node-gtk/Pango-1.0.js +0 -31
  55. package/lib/injection/classes/node-gtk/Pango-1.0.js.map +0 -1
  56. package/lib/package-data-parser.d.ts +0 -13
  57. package/lib/package-data-parser.js +0 -67
  58. package/lib/package-data-parser.js.map +0 -1
  59. package/lib/package-data.d.ts +0 -9
  60. package/lib/package-data.js +0 -41
  61. package/lib/package-data.js.map +0 -1
  62. package/lib/template-processor.d.ts +0 -114
  63. package/lib/template-processor.js +0 -252
  64. package/lib/template-processor.js.map +0 -1
  65. package/lib/types/package-section.d.ts +0 -8
  66. package/lib/types/package-section.js +0 -2
  67. package/lib/types/package-section.js.map +0 -1
  68. package/templates/README.md +0 -102
  69. package/templates/cogl-2-0.d.ts +0 -0
  70. package/templates/gjs/README-GJS.md +0 -109
  71. package/templates/gjs/ambient.d.ts +0 -59
  72. package/templates/gjs/cairo-1.0.d.ts +0 -9
  73. package/templates/gjs/cairo.d.ts +0 -8
  74. package/templates/gjs/cairo.js +0 -11
  75. package/templates/gjs/gettext.d.ts +0 -41
  76. package/templates/gjs/gettext.js +0 -11
  77. package/templates/gjs/gio-2.0.d.ts +0 -101
  78. package/templates/gjs/gjs.d.ts +0 -757
  79. package/templates/gjs/gjs.js +0 -10
  80. package/templates/gjs/gobject-2.0.d.ts +0 -238
  81. package/templates/gjs/module-ambient.d.ts +0 -31
  82. package/templates/gjs/module-import.d.ts +0 -33
  83. package/templates/gjs/module.append.d.ts +0 -1
  84. package/templates/gjs/module.d.ts +0 -12
  85. package/templates/gjs/module.js +0 -17
  86. package/templates/gjs/system.d.ts +0 -32
  87. package/templates/gjs/system.js +0 -11
  88. package/templates/gjs/tsconfig.alias.json +0 -12
  89. package/templates/granite-1.0.d.ts +0 -7
  90. package/templates/granite-7.0.d.ts +0 -7
  91. package/templates/gstbase-0.10.d.ts +0 -5
  92. package/templates/node-gtk/README-NODE-GTK.md +0 -71
  93. package/templates/node-gtk/ambient.d.ts +0 -19
  94. package/templates/node-gtk/gobject-2.0.d.ts +0 -57
  95. package/templates/node-gtk/module-import.d.ts +0 -29
  96. package/templates/node-gtk/module.append.d.ts +0 -1
  97. package/templates/node-gtk/module.d.ts +0 -10
  98. package/templates/node-gtk/module.js +0 -18
  99. package/templates/node-gtk/node-gtk.d.ts +0 -25
  100. package/templates/node-gtk/node-gtk.js +0 -7
  101. package/templates/package.json +0 -173
  102. package/templates/rygelserver-2.6.d.ts +0 -3
  103. package/templates/tsconfig.doc.json +0 -30
@@ -1,102 +0,0 @@
1
- <%# This template is used if the Option `package` is enabled %>
2
- # <%- packageName %>
3
-
4
- <%- PACKAGE_DESC %> using [<%- APP_NAME %>](<%- APP_SOURCE %>) v<%- APP_VERSION %>.
5
-
6
- <%_ if (typeof pkgData !== 'undefined' && pkgData.description) { _%>
7
- <%- pkgData.description %>
8
- <%_ } _%>
9
-
10
- ## Install
11
-
12
- To use this type definitions, install them with NPM:
13
- ```bash
14
- npm install <%- npmScope %>/<%- importName %>
15
- ```
16
-
17
- <%_ const pkg = dep.get(packageName) _%>
18
- <%_ if(!pkg){ _%>
19
- <%_ return `Package with package name "${packageName}" not found!` _%>
20
- <%_ } _%>
21
- ## Usage
22
-
23
- You can import this package into your project like this:
24
- ```ts
25
- import <%- pkg.namespace %> from '<%- pkg.importPath %>';
26
- ```
27
-
28
- Or if you prefer CommonJS, you can also use this:
29
- ```ts
30
- const <%- pkg.namespace %> = require('<%- pkg.importPath %>');
31
- ```
32
-
33
- ### Ambient Modules
34
-
35
- You can also use [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) to import this module like you would do this in JavaScript.
36
- For this you need to include `<%- npmScope %>/<%- importName %>` or `<%- npmScope %>/<%- importName %>/<%= environment === 'gjs' ? "ambient" : "import" %>` in your `tsconfig` or entry point Typescript file:
37
-
38
- `index.ts`:
39
- ```ts
40
- import '<%- npmScope %>/<%- importName %>'
41
- ```
42
-
43
- `tsconfig.json`:
44
- ```json
45
- {
46
- "compilerOptions": {
47
- ...
48
- },
49
- "include": ["<%- npmScope %>/<%- importName %>"],
50
- ...
51
- }
52
- ```
53
-
54
- Now you can import the ambient module with TypeScript support:
55
-
56
- <%_ if(environment === 'gjs'){ _%>
57
- ```ts
58
- import <%= pkg.namespace %> from 'gi://<%= pkg.namespace %>?version=<%= pkg.version %>';
59
- ```
60
- <%_ } else { _%>
61
- ```ts
62
- const gi = require('node-gtk')
63
- const <%= pkg.namespace %> = gi.require('<%= pkg.namespace %>', '<%= pkg.version %>')
64
- ```
65
- <%_ } _%>
66
-
67
- <%_ if(environment === 'gjs'){ _%>
68
- ### Global import
69
-
70
- You can also import the module with Typescript support using the global `imports.gi` object of GJS.
71
- For this you need to include `<%- npmScope %>/<%- importName %>` or `<%- npmScope %>/<%- importName %>/import` in your `tsconfig` or entry point Typescript file:
72
-
73
- `index.ts`:
74
- ```ts
75
- import '<%- npmScope %>/<%- importName %>'
76
- ```
77
-
78
- `tsconfig.json`:
79
- ```json
80
- {
81
- "compilerOptions": {
82
- ...
83
- },
84
- "include": ["<%- npmScope %>/<%- importName %>"],
85
- ...
86
- }
87
- ```
88
-
89
- Now you have also type support for this, too:
90
-
91
- ```ts
92
- const <%= pkg.namespace %> = imports.gi.<%= pkg.namespace %>;
93
- ```
94
- <%_ } _%>
95
-
96
- ### Bundle
97
-
98
- Depending on your project configuration, it is recommended to use a bundler like [esbuild](https://esbuild.github.io/). You can find examples using different bundlers [here](https://github.com/gjsify/ts-for-gir/tree/main/examples).
99
-
100
- ## Other packages
101
-
102
- All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
File without changes
@@ -1,109 +0,0 @@
1
- <%# This template is used for the README.md of @girs/gjs if the Option `package` is enabled %>
2
- # <%- packageName %>
3
-
4
- <%- PACKAGE_DESC %> using [<%- APP_NAME %>](<%- APP_SOURCE %>) v<%- APP_VERSION %>.
5
-
6
- <%_ if (typeof pkgData !== 'undefined' && pkgData.description) { _%>
7
- <%- pkgData.description %>
8
- <%_ } else { _%>
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
- <%_ } _%>
11
-
12
- ## Install
13
-
14
- To use this type definitions, install them with NPM:
15
- ```bash
16
- npm install <%- npmScope %>/<%- importName %>
17
- ```
18
-
19
- <%_ const pkg = dep.get(packageName) _%>
20
- <%_ if(!pkg){ _%>
21
- <%_ return `Package with package name "${packageName}" not found!` _%>
22
- <%_ } _%>
23
-
24
- ## Usage
25
-
26
- You can import this package into your project like this:
27
- ```ts
28
- import <%- pkg.namespace %> from '<%- pkg.importPath %>';
29
- ```
30
-
31
- Or if you prefer CommonJS, you can also use this:
32
- ```ts
33
- const <%- pkg.namespace %> = require('<%- pkg.importPath %>');
34
- ```
35
-
36
- ### Global types
37
-
38
- After the import, the global types of GJS are also available:
39
-
40
- ```ts
41
- console.log('Hello World from console');
42
- print('Hello World from print');
43
-
44
- const ByteArray = imports.byteArray;
45
-
46
- const encoder = new TextEncoder();
47
- const encoded = encoder.encode('𝓽𝓮𝔁𝓽');
48
-
49
- // And so on...
50
- ```
51
-
52
- ### Ambient Modules
53
-
54
- You can import the built in [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) of GJS.
55
- For this you need to include the `<%- npmScope %>/<%- importName %>` or `<%- npmScope %>/<%- importName %>/ambient` in your `tsconfig` or entry point Typescript file:
56
-
57
- `index.ts`:
58
- ```ts
59
- import '<%- npmScope %>/<%- importName %>'
60
- ```
61
-
62
- `tsconfig.json`:
63
- ```json
64
- {
65
- "compilerOptions": {
66
- ...
67
- },
68
- "include": ["<%- npmScope %>/<%- importName %>"],
69
- ...
70
- }
71
- ```
72
-
73
- Now you can import `gettext`, `system` and `cairo` in ESM style with Typescript support:
74
-
75
- ```ts
76
- import gettext from 'gettext';
77
- import system from 'system';
78
- import cairo from 'cairo';
79
- ```
80
-
81
- ### GIR modules
82
-
83
- If you want to have types for [GObject Introspection](https://gi.readthedocs.io/en/latest/) modules, you have to add them to your dependencies and import them as well, see the description of these modules, e.g. [gtk-4.0](https://www.npmjs.com/package/@girs/gtk-4.0), [gio-2.0](https://www.npmjs.com/package/@girs/gio-2.0), [adw-1](https://www.npmjs.com/package/@girs/adw-1) and [much more](https://github.com/gjsify/types).
84
-
85
- These types will then be available to you:
86
-
87
- ```ts
88
- import '@girs/gjs'
89
- import '@girs/gio-2.0'
90
- import '@girs/gtk-4.0'
91
- import '@girs/adw-1'
92
-
93
- import Gio from 'gi://Gio?version=2.0';
94
- import Gtk from 'gi://Gtk?version=4.0';
95
- import Adwaita from 'gi://adw?version=1';
96
-
97
- const button = new Gtk.Button();
98
-
99
- // ...
100
-
101
- ```
102
-
103
- ### Bundle
104
-
105
- Depending on your project configuration, it is recommended to use a bundler like [esbuild](https://esbuild.github.io/). You can find examples using different bundlers [here](https://github.com/gjsify/ts-for-gir/tree/main/examples).
106
-
107
- ## Other packages
108
-
109
- All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
@@ -1,59 +0,0 @@
1
- // https://www.typescriptlang.org/docs/handbook/modules.html#ambient-modules
2
- // https://stackoverflow.com/questions/45099605/ambient-declaration-with-an-imported-type-in-typescript
3
-
4
- declare module 'gettext' {
5
- <%_ if(package){ _%>
6
- export * from '@girs/gjs/gettext';
7
- import Gettext from '@girs/gjs/gettext';
8
- export default Gettext;
9
- <%_ } else { _%>
10
- const Gettext: typeof import('./gettext.js').default;
11
- export default Gettext;
12
-
13
- export const LocaleCategory: typeof import('./gettext.js').LocaleCategory;
14
- export const setlocale: typeof import('./gettext.js').setlocale;
15
- export const textdomain: typeof import('./gettext.js').textdomain;
16
- export const bindtextdomain: typeof import('./gettext.js').bindtextdomain;
17
- export const gettext: typeof import('./gettext.js').gettext;
18
- export const dgettext: typeof import('./gettext.js').dgettext;
19
- export const dcgettext: typeof import('./gettext.js').dcgettext;
20
- export const ngettext: typeof import('./gettext.js').ngettext;
21
- export const dngettext: typeof import('./gettext.js').dngettext;
22
- export const pgettext: typeof import('./gettext.js').pgettext;
23
- export const dpgettext: typeof import('./gettext.js').dpgettext;
24
- export const domain: typeof import('./gettext.js').domain;
25
- <%_ } _%>
26
- }
27
-
28
- declare module 'system' {
29
- <%_ if(package){ _%>
30
- export * from '@girs/gjs/system';
31
- import System from '@girs/gjs/system';
32
- export default System;
33
- <%_ } else { _%>
34
- const System: typeof import('./gettext.js').default;
35
- export default System;
36
-
37
- export const programInvocationName: typeof import('./system.js').programInvocationName;
38
- export const version: typeof import('./system.js').version;
39
- export const programPath: typeof import('./system.js').programPath;
40
- export const programArgs: typeof import('./system.js').programArgs;
41
- export const exit: typeof import('./system.js').exit;
42
- export const addressOfGObject: typeof import('./system.js').addressOfGObject;
43
- export const addressOf: typeof import('./system.js').addressOf;
44
- export const gc: typeof import('./system.js').gc;
45
- export const refcount: typeof import('./system.js').refcount;
46
- export const dumpHeap: typeof import('./system.js').dumpHeap;
47
- export const dumpMemoryInfo: typeof import('./system.js').dumpMemoryInfo;
48
- <%_ } _%>
49
- }
50
-
51
- declare module 'cairo' {
52
- <%_ if(package){ _%>
53
- import Cairo from '@girs/gjs/cairo';
54
- export default Cairo;
55
- <%_ } else { _%>
56
- const Cairo: typeof import('./cairo.js').default;
57
- export default Cairo;
58
- <%_ } _%>
59
- }
@@ -1,9 +0,0 @@
1
- // TODO
2
- // See
3
- // - https://gitlab.gnome.org/GNOME/gjs/-/blob/master/installed-tests/js/testCairoModule.js
4
- // - https://gitlab.gnome.org/GNOME/gjs/-/blob/master/installed-tests/js/testCairo.js
5
- // - https://gitlab.gnome.org/GNOME/gjs/-/blob/master/doc/cairo.md
6
-
7
- // image_surface_create -> ImageSurface
8
- // Context.constructor(surface: cairo.ImageSurface)
9
- // ...
@@ -1,8 +0,0 @@
1
- // TODO: See ./cairo-1.0.d.ts
2
- declare const Cairo: any;
3
-
4
- export default Cairo;
5
-
6
- <% if(moduleType === 'cjs') { %>
7
- // TODO declare named exports here, cairo doesn't have named exports for its esm module but for cjs we can use `const { Context } = imports.cairo` for that, see `./cairo.js`
8
- <% } %>
@@ -1,11 +0,0 @@
1
- <% if(moduleType === 'esm') { %>
2
- import Cairo from 'cairo';
3
-
4
- // cairo doesn't have named exports, see https://gitlab.gnome.org/GNOME/gjs/-/blob/c2a714f348d6848037f072063e0a914fd537c4f4/installed-tests/js/testCairoModule.js#L14
5
- export default Cairo;
6
- <% } else { %>
7
- const Cairo = imports.cairo;
8
-
9
- module.exports = Cairo;
10
- exports.default = Cairo;
11
- <% } %>
@@ -1,41 +0,0 @@
1
- export enum LocaleCategory {
2
- ALL,
3
- COLLATE,
4
- CTYPE,
5
- MESSAGES,
6
- MONETARY,
7
- NUMERIC,
8
- TIME,
9
- }
10
- export function setlocale(category: number, locale: string | null): string
11
- export function textdomain(domainname: string | null): string
12
- export function bindtextdomain(domainname: string, dirname: string | null): string
13
- export function gettext(msgid: string): string
14
- export function dgettext(domainname: string | null, msgid: string): string
15
- export function dcgettext(domainname: string | null, msgid: string, category: number): string
16
- export function ngettext(msgid: string, msgid_plural: string, n: number): string
17
- export function dngettext(domainname: string, msgid: string, msgid_plural: string, n: number): string
18
- export function pgettext(context: string, msgid: string): string
19
- export function dpgettext(dom: string | null, context: string, msgid: string): string
20
- export function domain(domainName: string): {
21
- gettext: (msgid: string) => string
22
- ngettext: (msgid: string, msgid_plural: string, n: number) => string
23
- pgettext: (context: string, msgid: string) => string
24
- }
25
-
26
- declare const Gettext: {
27
- LocaleCategory: typeof LocaleCategory,
28
- setlocale: typeof setlocale,
29
- textdomain: typeof textdomain,
30
- bindtextdomain: typeof bindtextdomain,
31
- gettext: typeof gettext,
32
- dgettext: typeof dgettext,
33
- dcgettext: typeof dcgettext,
34
- ngettext: typeof ngettext,
35
- dngettext: typeof dngettext,
36
- pgettext: typeof pgettext,
37
- dpgettext: typeof dpgettext,
38
- domain: typeof domain,
39
- }
40
-
41
- export default Gettext
@@ -1,11 +0,0 @@
1
- <% if(moduleType === 'esm') { %>
2
- import Gettext, { setlocale, textdomain, bindtextdomain, gettext, dgettext, dcgettext, ngettext, dngettext, pgettext, dpgettext, domain } from 'gettext';
3
-
4
- export { setlocale, textdomain, bindtextdomain, gettext, dgettext, dcgettext, ngettext, dngettext, pgettext, dpgettext, domain }
5
- export default Gettext;
6
- <% } else { %>
7
- const Gettext = imports.gettext;
8
-
9
- module.exports = Gettext;
10
- exports.default = Gettext;
11
- <% } %>
@@ -1,101 +0,0 @@
1
- // See https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/core/overrides/Gio.js
2
- export const DBus: {
3
- readonly session: DBusConnection;
4
- readonly system: DBusConnection;
5
- get(bus_type: BusType, cancellable?: Cancellable | null, callback?: AsyncReadyCallback | null): void;
6
- get_finish(res: AsyncResult): DBusConnection;
7
- get_sync(bus_type: BusType, cancellable?: Cancellable | null): DBusConnection;
8
- own_name(
9
- bus_type: BusType,
10
- name: string,
11
- flags: BusNameOwnerFlags,
12
- bus_acquired_closure?: GObject.Closure | null,
13
- name_acquired_closure?: GObject.Closure | null,
14
- name_lost_closure?: GObject.Closure | null
15
- ): number;
16
- own_name_on_connection(
17
- connection: DBusConnection,
18
- name: string,
19
- flags: BusNameOwnerFlags,
20
- name_acquired_closure?: GObject.Closure | null,
21
- name_lost_closure?: GObject.Closure | null
22
- ): number;
23
- unown_name(owner_id: number): void;
24
- watch_name(
25
- bus_type: BusType,
26
- name: string,
27
- flags: BusNameWatcherFlags,
28
- name_appeared_closure?: GObject.Closure | null,
29
- name_vanished_closure?: GObject.Closure | null
30
- ): number;
31
- unwatch_name(watcher_id: number): void;
32
- watch_name_on_connection(
33
- connection: DBusConnection,
34
- name: string,
35
- flags: BusNameWatcherFlags,
36
- name_appeared_closure?: GObject.Closure | null,
37
- name_vanished_closure?: GObject.Closure | null
38
- ): number;
39
- }
40
-
41
- export module DBusExportedObject {
42
- export interface ConstructorProperties {
43
- [key: string]: any;
44
- }
45
- }
46
-
47
- // See https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/core/overrides/Gio.js
48
- export class DBusExportedObject {
49
- static $gtype: GObject.GType<DBusExportedObject>;
50
-
51
- constructor(properties?: Partial<DBusExportedObject.ConstructorProperties>, ...args: any[]);
52
- _init(properties?: Partial<DBusExportedObject.ConstructorProperties>, ...args: any[]): void;
53
-
54
- static wrapJSObject(info: string, obj: any): DBusExportedObject;
55
- get_info(): DBusInterfaceInfo;
56
- get_connection(): DBusConnection;
57
- get_object_path(): string;
58
- unexport_from_connection(connection: DBusConnection): void;
59
- ["export"](busConnection: DBusConnection, objectPath: string): void;
60
- unexport(): void;
61
- flush(): void;
62
- emit_signal(name: string, variant: GLib.Variant): void;
63
- emit_property_changed(name: string, variant: GLib.Variant): void;
64
- }
65
-
66
- /**
67
- * A convenient helper to create Promise wrappers for asynchronous functions in GJS.
68
- *
69
- * This utility replaces the original function on the class prototype with a Promise-based version,
70
- * allowing the function to be called on any instance of the class, including subclasses.
71
- * Simply pass the class prototype, the "async" function name, and the "finish" function name as arguments.
72
- *
73
- * The function can be used like any other Promise, without the need for a custom wrapper, by leaving out the callback argument.
74
- * The original function will still be available, and can be used by passing the callback.
75
- *
76
- * @param proto - The class prototype that contains the asynchronous function.
77
- * @param asyncFunc - The name of the asynchronous function.
78
- * @param finishFunc - The name of the "finish" function that is used to retrieve the result of the asynchronous function.
79
- *
80
- * @version Gjs 1.54
81
- * @see https://gjs.guide/guides/gjs/asynchronous-programming.html#promisify-helper
82
- *
83
- * @example
84
- * ```js
85
- * import Gio from "gi://Gio?version=2.0";
86
- *
87
- * Gio._promisify(Gio.InputStream.prototype, 'read_bytes_async', 'read_bytes_finish');
88
- *
89
- * try {
90
- * const inputStream = new Gio.UnixInputStream({fd: 0});
91
- * const bytes = await inputStream.read_bytes_async(4096, GLib.PRIORITY_DEFAULT, null);
92
- * } catch (e) {
93
- * logError(e, 'Failed to read bytes');
94
- * }
95
- * ```
96
- *
97
- */
98
- export function _promisify(proto: any, asyncFunc: string, finishFunc?: string): void;
99
-
100
- /** Temporary Gio.File.prototype fix */
101
- export const _LocalFilePrototype: typeof File.prototype;