mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 15:41:48 +00:00
events: add EventTargetBase
EventTargetBase implements event target vtable for pure zig struct
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
const std = @import("std");
|
||||
|
||||
const parser = @import("../netsurf.zig");
|
||||
const c = @cImport({
|
||||
@cInclude("events/event_target.h");
|
||||
});
|
||||
|
||||
const EventTarget = @import("../dom/event_target.zig").EventTarget;
|
||||
|
||||
@@ -10,6 +13,9 @@ pub const Window = struct {
|
||||
pub const prototype = *EventTarget;
|
||||
pub const mem_guarantied = true;
|
||||
|
||||
// Extend libdom event target for pure zig struct.
|
||||
base: parser.EventTargetTBase = parser.EventTargetTBase{},
|
||||
|
||||
document: ?*parser.Document = null,
|
||||
target: []const u8,
|
||||
|
||||
@@ -42,6 +48,4 @@ pub const Window = struct {
|
||||
pub fn get_name(self: *Window) []const u8 {
|
||||
return self.target;
|
||||
}
|
||||
|
||||
// TODO we need to re-implement EventTarget interface.
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user