github.com/MontFerret/ferret@v0.18.0/pkg/drivers/cdp/templates/value.go (about)

     1  package templates
     2  
     3  import (
     4  	"github.com/mafredri/cdp/protocol/runtime"
     5  
     6  	"github.com/MontFerret/ferret/pkg/drivers/cdp/eval"
     7  	"github.com/MontFerret/ferret/pkg/runtime/core"
     8  )
     9  
    10  const getValue = `(el) => {
    11  	return el.value
    12  }`
    13  
    14  func GetValue(id runtime.RemoteObjectID) *eval.Function {
    15  	return eval.F(getValue).WithArgRef(id)
    16  }
    17  
    18  const setValue = `(el, value) => {
    19  	el.value = value
    20  }`
    21  
    22  func SetValue(id runtime.RemoteObjectID, value core.Value) *eval.Function {
    23  	return eval.F(setValue).WithArgRef(id).WithArgValue(value)
    24  }