events: create an EventHandlerData struct

It simplifies the EventHandlerFunc creation and allows to insert user's
data.
This commit is contained in:
Pierre Tachoire
2024-06-19 17:03:40 +02:00
parent 522b293149
commit 1924f136c6
4 changed files with 107 additions and 59 deletions

View File

@@ -52,9 +52,9 @@ pub const XMLHttpRequestEventTarget = struct {
@as(*parser.EventTarget, @ptrCast(self)),
alloc,
typ,
cbk,
false,
EventHandler,
.{ .cbk = cbk },
false,
);
}
fn unregister(self: *XMLHttpRequestEventTarget, alloc: std.mem.Allocator, typ: []const u8, cbk: Callback) !void {