Skip to content

Use EventEmitter class instead of injecting Signal methods

Evan Welsh requested to merge ewlsh/gnome-shell:ewlsh/event-emitter into main

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.

In the future this class may also adopt convenience APIs for automatic signal handling.

The name EventEmitter mirrors a common name for this pattern in Node and in JS libraries.

Preparation for !1499 (merged)

Edited by Evan Welsh

Merge request reports