Adopt EventEmitter class instead of injecting Signal methods
Introduce a new class, EventEmitter, which implements signal handling for pure JavaScript classes. EventEmitter still utilizes GJS' addSignalMethods internally. EventEmitter allows static typechecking to understand the structure of event-emitting JS classes and makes creating child classes simpler. The name 'EventEmitter' mirrors a common name for this pattern in Node and in JS libraries. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2043>
This commit is contained in:
@ -45,7 +45,6 @@ try {
|
||||
|
||||
const { Clutter, Gio, GLib, GObject, Meta, Polkit, Shell, St } = imports.gi;
|
||||
const Gettext = imports.gettext;
|
||||
const Signals = imports.signals;
|
||||
const System = imports.system;
|
||||
const SignalTracker = imports.misc.signalTracker;
|
||||
|
||||
@ -358,12 +357,6 @@ function init() {
|
||||
SignalTracker.disconnectObject(this, ...args);
|
||||
};
|
||||
|
||||
const _addSignalMethods = Signals.addSignalMethods;
|
||||
Signals.addSignalMethods = function (prototype) {
|
||||
_addSignalMethods(prototype);
|
||||
SignalTracker.addObjectSignalMethods(prototype);
|
||||
};
|
||||
|
||||
SignalTracker.registerDestroyableType(Clutter.Actor);
|
||||
|
||||
// Miscellaneous monkeypatching
|
||||
|
Reference in New Issue
Block a user