mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 15:41:48 +00:00
browser: inject window global object
This commit is contained in:
@@ -143,10 +143,9 @@ pub const Page = struct {
|
||||
// add global objects
|
||||
log.debug("setup global env", .{});
|
||||
const window = Window.create(doc, null);
|
||||
_ = window;
|
||||
// TODO should'nt we share the same pointer between instances of window?
|
||||
// try js_env.addObject(apis, window, "self");
|
||||
// try js_env.addObject(apis, window, "window");
|
||||
try self.env.addObject(apis, window, "self");
|
||||
try self.env.addObject(apis, window, "window");
|
||||
try self.env.addObject(apis, doc, "document");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const generate = @import("../generate.zig");
|
||||
|
||||
const Window = @import("window.zig");
|
||||
const Window = @import("window.zig").Window;
|
||||
|
||||
pub const Interfaces = generate.Tuple(.{
|
||||
Window,
|
||||
|
||||
@@ -17,15 +17,15 @@ pub const Window = struct {
|
||||
};
|
||||
}
|
||||
|
||||
pub fn get_window(self: *Window) *parser.Document {
|
||||
pub fn get_window(self: *Window) *Window {
|
||||
return self;
|
||||
}
|
||||
|
||||
pub fn get_self(self: *Window) *parser.Document {
|
||||
pub fn get_self(self: *Window) *Window {
|
||||
return self;
|
||||
}
|
||||
|
||||
pub fn get_parent(self: *Window) *parser.Document {
|
||||
pub fn get_parent(self: *Window) *Window {
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user