Skip to content

API Reference / @gtkx/react / useSignal

Function: useSignal()

useSignal<T, S>(object, signal, handler, options?): void

Defined in: react/dist/hooks/use-signal.d.ts:19

Connects a handler to a GObject signal for the lifetime of the component, reconnecting when the object changes.

Type Parameters

T

T extends Object

S

S extends string

Parameters

object

ObjectProp<T>

The GObject (or ref to one) to connect to.

signal

S

The signal name, optionally with a detail suffix.

handler

SignalHandlerFor<T, S>

The callback invoked when the signal is emitted.

options?

UseSignalOptions

Connection options such as running after the default handler or invoking immediately.

Returns

void

Released under the MPL-2.0 License.