I've always thought of signals and slots approximately like this (only more complex). Pseudo-code:
template <typeList T>
class Signal {
public void emit(T params) {
foreach (slot in _slotList) {
slot(params);
}
}
public void connectSlot(void slot(T)) {
_slotList.pushBack(slot);
}
private list<void function(T)> _slotList;
}
template <typeList T>
class Signal {
public void emit(T params) {
foreach (slot in _slotList) {
slot(params);
}
}
public void connectSlot(void slot(T)) {
_slotList.pushBack(slot);
}
private list<void function(T)> _slotList;
}
To copy to clipboard, switch view to plain text mode
You know what I mean. It's like the observer pattern, only more flexible.
(I never thought the event loop had anything to do with it.)
Bookmarks