Skip to content

Commit

Permalink
Add new asyncRun overrides, fixes #130
Browse files Browse the repository at this point in the history
  • Loading branch information
JumpLink committed Nov 27, 2023
1 parent 41127e7 commit f8aeabf
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
24 changes: 23 additions & 1 deletion packages/lib/src/injection/classes/gjs/gio-2.0.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
import type { InjectionClass } from '../../../types/index.js'
import type { InjectionClass, InjectionFunction } from '../../../types/index.js'

// See https://github.com/gjsify/ts-for-gir/issues/130
const runAsyncMethod: InjectionFunction = {
name: 'runAsync',
girTypeName: 'method',
inParams: [
{
name: 'argv',
type: [{ type: 'string', isArray: true, optional: true }],
},
],
returnTypes: [
{
type: 'Promise<number>',
},
],
}

/**
* @see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/core/overrides/Gio.js
*/
export const classesGio20Gjs: InjectionClass[] = [
{
versions: ['2.0'],
qualifiedName: 'Gio.Application',
methods: [runAsyncMethod],
},
{
versions: ['2.0'],
qualifiedName: 'Gio.DBusProxy',
Expand Down
19 changes: 18 additions & 1 deletion packages/lib/src/injection/classes/gjs/glib-2.0.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
import type { InjectionClass } from '../../../types/index.js'
import type { InjectionClass, InjectionFunction } from '../../../types/index.js'

// See https://github.com/gjsify/ts-for-gir/issues/130
const runAsyncMethod: InjectionFunction = {
name: 'runAsync',
girTypeName: 'method',
inParams: [],
returnTypes: [
{
type: 'Promise<void>',
},
],
}

export const classesGLib20Gjs: InjectionClass[] = [
{
versions: ['2.0'],
qualifiedName: 'GLib.MainLoop',
methods: [runAsyncMethod],
},
// https://gjs.guide/guides/glib/gvariant.html#unpacking-variants
{
versions: ['2.0'],
Expand Down

0 comments on commit f8aeabf

Please sign in to comment.