mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 04:34:44 +00:00
feat: fetch add wait_until parameter for page loads options
Add `--wait_until` and `--wait_ms` CLI arguments to configure session wait behavior. Updates `Session.wait` to evaluate specific page load states (`load`, `domcontentloaded`, `networkidle`, `fixed`) before completing the wait loop.
This commit is contained in:
@@ -46,6 +46,7 @@ const IS_DEBUG = @import("builtin").mode == .Debug;
|
||||
|
||||
pub const FetchOpts = struct {
|
||||
wait_ms: u32 = 5000,
|
||||
wait_until: Config.WaitUntil = .load,
|
||||
dump: dump.Opts,
|
||||
dump_mode: ?Config.DumpFormat = null,
|
||||
writer: ?*std.Io.Writer = null,
|
||||
@@ -107,7 +108,7 @@ pub fn fetch(app: *App, url: [:0]const u8, opts: FetchOpts) !void {
|
||||
.reason = .address_bar,
|
||||
.kind = .{ .push = null },
|
||||
});
|
||||
_ = session.wait(opts.wait_ms);
|
||||
_ = session.wait(opts.wait_ms, opts.wait_until);
|
||||
|
||||
const writer = opts.writer orelse return;
|
||||
if (opts.dump_mode) |mode| {
|
||||
|
||||
Reference in New Issue
Block a user