Documentation ¶
Overview ¶
Package meta provides signals and slots for the Observer pattern.
Note: This is a proof of concept package, therefore you are not supposed to use it in production or any near. Public API of this package is likely to change (a lot).
Signals and slots is a language construct introduced in Qt for communication between objects which makes it easy to implement the Observer pattern while avoiding boilerplate code. The concept is that GUI widgets can send signals containing event information which can be received by other controls using special functions, known as slots.
Once a signal gets emitted, all the slots connected are being executed in the distinct goroutines. Value passed to the signal is available from the call context object.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Disconnect ¶
func Disconnect(sig *Signal, cid Connection)
Disconnect does the opposite to connect.
Types ¶
type Call ¶
type Call struct {
Data interface{}
}
Call stands for the call context, handled in the slot.
type Connection ¶
type Connection int
Connection is a signal-slot connection descriptor, unique within the lifetime of the signal.
You may use it to terminate existing connections.
func Connect ¶
func Connect(sig *Signal, slot Slot) Connection
Connect attaches a new slot to the signal. It also does panic if any of the params given is equal to nil.