eval

package
v0.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2023 License: Apache-2.0 Imports: 13 Imported by: 9

Documentation

Index

Constants

View Source
const (
	EmptyExecutionContextID = runtime.ExecutionContextID(-1)
	EmptyObjectID           = runtime.RemoteObjectID("")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CompiledFunction added in v0.16.0

type CompiledFunction struct {
	// contains filtered or unexported fields
}

func CF added in v0.16.0

type Function added in v0.16.0

type Function struct {
	// contains filtered or unexported fields
}

func F added in v0.16.0

func F(exp string) *Function

func (*Function) AsAnonymous added in v0.16.0

func (fn *Function) AsAnonymous() *Function

func (*Function) AsAsync added in v0.16.0

func (fn *Function) AsAsync() *Function

func (*Function) AsNamed added in v0.16.0

func (fn *Function) AsNamed(name string) *Function

func (*Function) AsSync added in v0.16.0

func (fn *Function) AsSync() *Function

func (*Function) CallOn added in v0.16.0

func (fn *Function) CallOn(id runtime.RemoteObjectID) *Function

func (*Function) Length added in v0.16.0

func (fn *Function) Length() int

func (*Function) String added in v0.16.0

func (fn *Function) String() string

func (*Function) WithArg added in v0.16.0

func (fn *Function) WithArg(value interface{}) *Function

func (*Function) WithArgRef added in v0.16.0

func (fn *Function) WithArgRef(id runtime.RemoteObjectID) *Function

func (*Function) WithArgRemoteValue added in v0.16.0

func (fn *Function) WithArgRemoteValue(value RemoteValue) *Function

func (*Function) WithArgSelector added in v0.16.0

func (fn *Function) WithArgSelector(selector drivers.QuerySelector) *Function

func (*Function) WithArgValue added in v0.16.0

func (fn *Function) WithArgValue(value core.Value) *Function

type FunctionArguments added in v0.16.0

type FunctionArguments []runtime.CallArgument

func (FunctionArguments) MarshalZerologArray added in v0.16.0

func (args FunctionArguments) MarshalZerologArray(a *zerolog.Array)

type RemoteClassName added in v0.16.0

type RemoteClassName string
const (
	UnknownClassName  RemoteClassName = ""
	DocumentClassName RemoteClassName = "HTMLDocument"
)

List of supported remote classses

func ToRemoteClassName added in v0.16.0

func ToRemoteClassName(ref runtime.RemoteObject) RemoteClassName

type RemoteObjectType added in v0.16.0

type RemoteObjectType string
const (
	UnknownObjectType     RemoteObjectType = ""
	NullObjectType        RemoteObjectType = "null"
	UndefinedObjectType   RemoteObjectType = "undefined"
	ArrayObjectType       RemoteObjectType = "array"
	NodeObjectType        RemoteObjectType = "node"
	RegexpObjectType      RemoteObjectType = "regexp"
	DateObjectType        RemoteObjectType = "date"
	MapObjectType         RemoteObjectType = "map"
	SetObjectType         RemoteObjectType = "set"
	WeakMapObjectType     RemoteObjectType = "weakmap"
	WeakSetObjectType     RemoteObjectType = "weakset"
	IteratorObjectType    RemoteObjectType = "iterator"
	GeneratorObjectType   RemoteObjectType = "generator"
	ErrorObjectType       RemoteObjectType = "error"
	ProxyObjectType       RemoteObjectType = "proxy"
	PromiseObjectType     RemoteObjectType = "promise"
	TypedArrayObjectType  RemoteObjectType = "typedarray"
	ArrayBufferObjectType RemoteObjectType = "arraybuffer"
	DataViewObjectType    RemoteObjectType = "dataview"
)

List of possible remote object types

func ToRemoteObjectType added in v0.16.0

func ToRemoteObjectType(ref runtime.RemoteObject) RemoteObjectType

type RemoteType added in v0.16.0

type RemoteType string
const (
	UnknownType   RemoteType = ""
	UndefinedType RemoteType = "undefined"
	StringType    RemoteType = "string"
	NumberType    RemoteType = "number"
	BooleanType   RemoteType = "boolean"
	SymbolType    RemoteType = "symbol"
	BigintType    RemoteType = "bigint"
	ObjectType    RemoteType = "object"
)

List of possible remote types "object", "function", "undefined", "string", "number", "boolean", "symbol", "bigint"

func ToRemoteType added in v0.16.0

func ToRemoteType(ref runtime.RemoteObject) RemoteType

type RemoteValue added in v0.16.0

type RemoteValue interface {
	RemoteID() runtime.RemoteObjectID
}

type Resolver added in v0.16.0

type Resolver struct {
	// contains filtered or unexported fields
}

func NewResolver added in v0.16.0

func NewResolver(runtime cdp.Runtime, frameID page.FrameID) *Resolver

func (*Resolver) SetLoader added in v0.16.0

func (r *Resolver) SetLoader(loader ValueLoader) *Resolver

func (*Resolver) ToElement added in v0.16.0

func (*Resolver) ToProperties added in v0.16.0

func (r *Resolver) ToProperties(
	ctx context.Context,
	id runtime.RemoteObjectID,
) (*values.Array, error)

func (*Resolver) ToProperty added in v0.16.0

func (r *Resolver) ToProperty(
	ctx context.Context,
	id runtime.RemoteObjectID,
	propName string,
) (core.Value, error)

func (*Resolver) ToValue added in v0.16.0

func (r *Resolver) ToValue(ctx context.Context, ref runtime.RemoteObject) (core.Value, error)

type ReturnType added in v0.16.0

type ReturnType int
const (
	ReturnNothing ReturnType = iota
	ReturnValue
	ReturnRef
)

func (ReturnType) String added in v0.16.0

func (rt ReturnType) String() string

type Runtime added in v0.16.0

type Runtime struct {
	// contains filtered or unexported fields
}

func Create added in v0.16.0

func Create(
	ctx context.Context,
	logger zerolog.Logger,
	client *cdp.Client,
	frameID page.FrameID,
) (*Runtime, error)

func New added in v0.16.0

func New(
	logger zerolog.Logger,
	client *cdp.Client,
	frameID page.FrameID,
	contextID runtime.ExecutionContextID,
) *Runtime

func (*Runtime) Call added in v0.16.0

func (rt *Runtime) Call(ctx context.Context, fn *CompiledFunction) error

func (*Runtime) CallElement added in v0.16.0

func (rt *Runtime) CallElement(ctx context.Context, fn *CompiledFunction) (drivers.HTMLElement, error)

func (*Runtime) CallElements added in v0.16.0

func (rt *Runtime) CallElements(ctx context.Context, fn *CompiledFunction) (*values.Array, error)

func (*Runtime) CallRef added in v0.16.0

func (*Runtime) CallValue added in v0.16.0

func (rt *Runtime) CallValue(ctx context.Context, fn *CompiledFunction) (core.Value, error)

func (*Runtime) Compile added in v0.16.0

func (rt *Runtime) Compile(ctx context.Context, fn *Function) (*CompiledFunction, error)

func (*Runtime) ContextID added in v0.16.0

func (rt *Runtime) ContextID() runtime.ExecutionContextID

func (*Runtime) Eval added in v0.16.0

func (rt *Runtime) Eval(ctx context.Context, fn *Function) error

func (*Runtime) EvalElement added in v0.16.0

func (rt *Runtime) EvalElement(ctx context.Context, fn *Function) (core.Value, error)

func (*Runtime) EvalElements added in v0.16.0

func (rt *Runtime) EvalElements(ctx context.Context, fn *Function) (*values.Array, error)

func (*Runtime) EvalRef added in v0.16.0

func (rt *Runtime) EvalRef(ctx context.Context, fn *Function) (runtime.RemoteObject, error)

func (*Runtime) EvalValue added in v0.16.0

func (rt *Runtime) EvalValue(ctx context.Context, fn *Function) (core.Value, error)

func (*Runtime) SetLoader added in v0.16.0

func (rt *Runtime) SetLoader(loader ValueLoader) *Runtime

type ValueLoader added in v0.16.0

type ValueLoader interface {
	Load(
		ctx context.Context,
		frameID page.FrameID,
		remoteType RemoteObjectType,
		remoteClass RemoteClassName,
		id runtime.RemoteObjectID,
	) (core.Value, error)
}

type ValueLoaderFn added in v0.16.0

type ValueLoaderFn func(
	ctx context.Context,
	frameID page.FrameID,
	remoteType RemoteObjectType,
	remoteClass RemoteClassName,
	id runtime.RemoteObjectID,
) (core.Value, error)

func (ValueLoaderFn) Load added in v0.16.0

func (f ValueLoaderFn) Load(
	ctx context.Context,
	frameID page.FrameID,
	remoteType RemoteObjectType,
	remoteClass RemoteClassName,
	id runtime.RemoteObjectID,
) (core.Value, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL