Skip to content

Commit c66e9ea

Browse files
authored
Merge pull request #25 from swsnr/gnome46/scrutinize-more-types
Mark event emitter and popup menu for GNOME 46
2 parents e5ec0cf + 22e20b4 commit c66e9ea

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

packages/gnome-shell/src/misc/signals.d.ts

+12-9
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ type SignalMap<K> = {
1313
* @example
1414
* ```ts
1515
* const Signals = imports.signals;
16-
*
16+
*
1717
* // Define an interface with the same name of your class to make the methods known
1818
* interface Events extends Signals.Methods {}
19-
*
19+
*
2020
* class Events {}
2121
* Signals.addSignalMethods(Events.prototype);
22-
*
22+
*
2323
* const events = new Events();
24-
*
24+
*
2525
* // Typescript will not complain here
2626
* events.emit("test-signal", "test argument");
2727
* ```
@@ -30,21 +30,21 @@ export interface SignalMethods<S extends SignalMap<S> = any> {
3030
/**
3131
* Connects a callback to a signal for an object. Pass the returned ID to
3232
* `disconnect()` to remove the handler.
33-
*
33+
*
3434
* If `callback` returns `true`, emission will stop and no other handlers will be
3535
* invoked.
36-
*
36+
*
3737
* > Warning: Unlike GObject signals, `this` within a signal callback will always
3838
* > refer to the global object (ie. `globalThis`).
39-
*
39+
*
4040
* @param sigName A signal name
4141
* @param callback A callback function
4242
* @returns A handler ID
4343
*/
4444
connect<Name extends keyof S>(sigName: Name, callback: (self: this, ...args: S[Name]) => boolean | undefined): number;
4545
/**
4646
* Emits a signal for an object. Emission stops if a signal handler returns `true`.
47-
*
47+
*
4848
* Unlike GObject signals, it is not necessary to declare signals or define their
4949
* signature. Simply call `emit()` with whatever signal name you wish, with
5050
* whatever arguments you wish.
@@ -71,6 +71,9 @@ export interface SignalMethods<S extends SignalMap<S> = any> {
7171

7272
export interface EventEmitter<S extends SignalMap<S> = any> extends SignalMethods<S> {}
7373

74+
/**
75+
* @version 46
76+
*/
7477
export class EventEmitter<S extends SignalMap<S> = any> {
7578
connectObject(...args: any[]): number // TODO: return type is return type of imports.misc.signalTracker.connectObject
7679

@@ -79,4 +82,4 @@ export class EventEmitter<S extends SignalMap<S> = any> {
7982
connect_object(...args: any[]): ReturnType<typeof this.connectObject>
8083

8184
disconnect_object(...args: any[]): ReturnType<typeof this.disconnectObject>
82-
}
85+
}

packages/gnome-shell/src/ui/popupMenu.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ export namespace PopupSubMenu {
221221
interface SignalMap extends PopupMenuBase.SignalMap {}
222222
}
223223

224+
/**
225+
* @version 46
226+
*/
224227
export class PopupSubMenu<S extends Signals.SignalMap<S> = PopupSubMenu.SignalMap> extends PopupMenuBase<S> {
225228
actor: St.ScrollView;
226229

0 commit comments

Comments
 (0)