|
|
@ -14,7 +14,7 @@ pub const Dispatcher = struct {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn deinit(self: Dispatcher) void {
|
|
|
|
pub fn deinit(self: *Dispatcher) void {
|
|
|
|
var it = self.signals.iterator();
|
|
|
|
var it = self.signals.iterator();
|
|
|
|
while (it.next()) |ptr| {
|
|
|
|
while (it.next()) |ptr| {
|
|
|
|
// HACK: we dont know the Type here but we need to call deinit
|
|
|
|
// HACK: we dont know the Type here but we need to call deinit
|
|
|
@ -27,8 +27,8 @@ pub const Dispatcher = struct {
|
|
|
|
|
|
|
|
|
|
|
|
fn assure(self: *Dispatcher, comptime T: type) *Signal(T) {
|
|
|
|
fn assure(self: *Dispatcher, comptime T: type) *Signal(T) {
|
|
|
|
var type_id = utils.typeId(T);
|
|
|
|
var type_id = utils.typeId(T);
|
|
|
|
if (self.signals.get(type_id)) |kv| {
|
|
|
|
if (self.signals.get(type_id)) |value| {
|
|
|
|
return @intToPtr(*Signal(T), kv.value);
|
|
|
|
return @intToPtr(*Signal(T), value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var signal = Signal(T).create(self.allocator);
|
|
|
|
var signal = Signal(T).create(self.allocator);
|
|
|
|