mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-08 04:57:32 -04:00
intial setup for passing arbitrary data to hooks
This commit is contained in:
parent
eeb6bf2278
commit
2c130539f6
4 changed files with 42 additions and 24 deletions
|
|
@ -41,12 +41,12 @@ pub fn put(self: *Events, key: []const u8, hook: *const Hook) !void {
|
|||
// TODO: figure out deletion
|
||||
// pub fn del(self: *Events, key: ???) !void {}
|
||||
|
||||
pub fn exec(self: *Events, event: []const u8) void {
|
||||
pub fn exec(self: *Events, event: []const u8, args: anytype) void {
|
||||
if (self.events.get(event)) |e| {
|
||||
var node = e.first;
|
||||
while (node) |n| : (node = n.next) {
|
||||
const data: *Node = @fieldParentPtr("node", n);
|
||||
data.hook.callback();
|
||||
data.hook.callback(args);
|
||||
|
||||
// FIXME: not sure why but for some reason our ll doesn't seem to want to
|
||||
// admit that there's nothing after the first node.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue