Skip to content

Commit

Permalink
Add specification for binding mechanism
Browse files Browse the repository at this point in the history
Provide a way to communicate from scripts evaluated on the page side to
the BiDi client. Safe (non-observable by the page script) analog of the
CDP command Runtime.addBinding.

WIP: #295
  • Loading branch information
Thiago Perrotta committed Dec 5, 2022
1 parent 2d2de70 commit 41636c2
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/bidiMapper/domains/protocol/bidiProtocolTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,20 @@ export namespace CommonDataTypes {
});
export type RemoteReference = zod.infer<typeof RemoteReferenceSchema>;

// BindingValue = {
// type: "binding",
// value: text,
// }
export const BindingValueSchema = zod.object({
type: zod.literal('binding'),
value: zod.string(),
});

// UndefinedValue = {
// type: "undefined",
// }
const UndefinedValueSchema = zod.object({type: zod.literal('undefined')});

//
// NullValue = {
// type: "null",
// }
Expand All @@ -126,7 +134,6 @@ export namespace CommonDataTypes {
'-Infinity',
]);

//
// NumberValue = {
// type: "number",
// value: number / SpecialNumber,
Expand Down Expand Up @@ -541,7 +548,6 @@ export namespace Script {
realm: zod.string().min(1),
});

//
// Target = (
// RealmTarget //
// ContextTarget
Expand Down Expand Up @@ -603,6 +609,7 @@ export namespace Script {
const ArgumentValueSchema = zod.union([
CommonDataTypes.RemoteReferenceSchema,
CommonDataTypes.LocalValueSchema,
CommonDataTypes.BindingValueSchema,
]);
export type ArgumentValue = zod.infer<typeof ArgumentValueSchema>;

Expand Down Expand Up @@ -734,7 +741,6 @@ export namespace BrowsingContext {
};

// BrowsingContextCreateType = "tab" / "window"
//
// BrowsingContextCreateParameters = {
// type: BrowsingContextCreateType
// }
Expand Down

0 comments on commit 41636c2

Please sign in to comment.