-
Notifications
You must be signed in to change notification settings - Fork 288
First implementation of Event system #156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
51f921d to
1c9a8c2
Compare
src/dom/event_target.zig
Outdated
| eventType: []const u8, | ||
| cbk: Callback, | ||
| ) !void { | ||
| // TODO: when can we free this allocation? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on the removeListener call maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes of course. But I want to investigate the lifetime of the Callback to see if we can do it before.
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
e827f7f to
5952902
Compare
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
dcd7b74 to
ef6c36b
Compare
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
|
In order to try to pass some of the new WPT tests, I suggest to implement
|
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
src/netsurf.zig
Outdated
| // EventListener | ||
| pub const EventListener = c.dom_event_listener; | ||
|
|
||
| pub fn eventListenerGetData(lst: *EventListener) ?*anyopaque { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could directly return a *Callback here isn't it?
src/netsurf.zig
Outdated
| return getVtable(c.dom_event_target_vtable, EventTarget, et); | ||
| } | ||
|
|
||
| pub fn eventTargetHasListener(et: *EventTarget, typ: []const u8, cbk_id: usize) !?*EventListener { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the cbk_id: usize.
It seems inconsistent w/ the eventTargetAddEventListener signature which expects a cbk_ptr: *Callback.
And check if callback has been already added in addEventListener Signed-off-by: Francis Bouvier <francis@lightpanda.io>
b9b57bf to
9ba4c69
Compare
And unify the way allocator is used on eventTarget add/remove listener Signed-off-by: Francis Bouvier <francis@lightpanda.io>
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
Closes #36