mirror of
https://github.com/MontFerret/ferret.git
synced 2025-07-03 00:46:51 +02:00
* Added support of pre-compiled eval expressions * Added unit tests for eval.Function * Added RemoteType and RemoteObjectType enums * Refactored function generation * Refactored Document and Element loading logic * Removed redundant fields from cdp.Page * Exposed eval.Runtime to external callers * Added new eval.RemoteValue interface
23 lines
562 B
Go
23 lines
562 B
Go
package dom
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/MontFerret/ferret/pkg/drivers/cdp/eval"
|
|
"github.com/MontFerret/ferret/pkg/runtime/core"
|
|
"github.com/mafredri/cdp/protocol/page"
|
|
"github.com/mafredri/cdp/protocol/runtime"
|
|
)
|
|
|
|
type NodeLoader struct {
|
|
dom *Manager
|
|
}
|
|
|
|
func NewNodeLoader(dom *Manager) eval.ValueLoader {
|
|
return &NodeLoader{dom}
|
|
}
|
|
|
|
func (n *NodeLoader) Load(ctx context.Context, frameID page.FrameID, _ eval.RemoteObjectType, _ eval.RemoteClassName, id runtime.RemoteObjectID) (core.Value, error) {
|
|
return n.dom.ResolveElement(ctx, frameID, id)
|
|
}
|