GObject.signal_has_handler_pending

function signal_has_handler_pending(instance: GObject.Object, signal_id: Number(guint), detail: GLib.Quark, may_be_blocked: Boolean): Boolean {
    // Gjs wrapper for g_signal_has_handler_pending()
}
  

Returns whether there are any handlers connected to instance for the given signal id and detail.

One example of when you might use this is when the arguments to the signal are difficult to compute. A class implementor may opt to not emit the signal if no one is attached anyway, thus saving the cost of building the arguments.

instance

the object whose signal handlers are sought.

signal_id

the signal id.

detail

the detail.

may_be_blocked

whether blocked handlers should count as match.

Returns

true if a handler is connected to the signal, false otherwise.