mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 07:31:47 +00:00
First implementation of Event system
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
29
src/events/event.zig
Normal file
29
src/events/event.zig
Normal file
@@ -0,0 +1,29 @@
|
||||
const std = @import("std");
|
||||
|
||||
const generate = @import("../generate.zig");
|
||||
|
||||
const parser = @import("../netsurf.zig");
|
||||
|
||||
const DOMException = @import("../dom/exceptions.zig").DOMException;
|
||||
|
||||
pub const Event = struct {
|
||||
pub const Self = parser.Event;
|
||||
pub const Exception = DOMException;
|
||||
pub const mem_guarantied = true;
|
||||
|
||||
// JS funcs
|
||||
// --------
|
||||
|
||||
pub fn constructor(eventType: []const u8) !*parser.Event {
|
||||
const event = try parser.eventCreate();
|
||||
try parser.eventInit(event, eventType);
|
||||
return event;
|
||||
}
|
||||
};
|
||||
|
||||
// Event interfaces
|
||||
pub const Interfaces = generate.Tuple(.{
|
||||
Event,
|
||||
});
|
||||
const Generated = generate.Union.compile(Interfaces);
|
||||
pub const Union = Generated._union;
|
||||
Reference in New Issue
Block a user