Skip to content

Commit

Permalink
Move JSHandle to js_handle.go
Browse files Browse the repository at this point in the history
  • Loading branch information
inancgumus committed Oct 10, 2023
1 parent dd68401 commit f0c037e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 deletions.
22 changes: 0 additions & 22 deletions common/api.go

This file was deleted.

17 changes: 17 additions & 0 deletions common/js_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,26 @@ import (

"github.com/chromedp/cdproto/cdp"
"github.com/chromedp/cdproto/runtime"
cdpruntime "github.com/chromedp/cdproto/runtime"
"github.com/dop251/goja"
)

// JSHandleAPI is the interface of an in-page JS object.
//
// TODO: Find a way to move this to a concrete type. It's too difficult to
// do that right now because of the tests and the way we're using the
// JSHandleAPI interface.
type JSHandleAPI interface {
AsElement() *ElementHandle
Dispose()
Evaluate(pageFunc goja.Value, args ...goja.Value) any
EvaluateHandle(pageFunc goja.Value, args ...goja.Value) (JSHandleAPI, error)
GetProperties() (map[string]JSHandleAPI, error)
GetProperty(propertyName string) JSHandleAPI
JSONValue() goja.Value
ObjectID() cdpruntime.RemoteObjectID
}

type jsHandle interface {
JSHandleAPI
dispose() error
Expand Down

0 comments on commit f0c037e

Please sign in to comment.