Add sendEvent utility function

Signed-off-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
Francis Bouvier
2024-04-19 17:11:31 +02:00
parent ed38705efd
commit 9e13ffb8ff
4 changed files with 67 additions and 23 deletions

View File

@@ -81,15 +81,7 @@ fn tagetSetAutoAttach(
.browserContextId = BrowserContextID,
},
};
const event = try cdp.method(
alloc,
"Target.attachedToTarget",
AttachToTarget,
attached,
null,
);
std.log.debug("event {s}", .{event});
try server.sendSync(ctx, event);
try cdp.sendEvent(alloc, ctx, "Target.attachedToTarget", AttachToTarget, attached, null);
}
return result(alloc, id, null, null, sessionID);
@@ -196,15 +188,7 @@ fn createTarget(
},
.waitingForDebugger = true,
};
const event = try cdp.method(
alloc,
"Target.attachedToTarget",
AttachToTarget,
attached,
sessionID,
);
std.log.debug("event {s}", .{event});
try server.sendSync(ctx, event);
try cdp.sendEvent(alloc, ctx, "Target.attachedToTarget", AttachToTarget, attached, sessionID);
// output
const Resp = struct {