Documentation
¶
Index ¶
- Constants
- Variables
- func Compare(first, second runtime.Type) int
- func CompareTo(first runtime.Type, second runtime.Value) int
- func CompareTypes(first, second runtime.Value) int
- func IsScreenshotFormatValid(format string) bool
- func NewHTTPHeadersProxy(header *HTTPHeaders) runtime.Value
- func WithContext(ctx context.Context, drv Driver, opts ...GlobalOption) context.Context
- type Container
- func (c *Container) Get(name string) (Driver, bool)
- func (c *Container) GetAll() []Driver
- func (c *Container) Has(name string) bool
- func (c *Container) Register(drv Driver, opts ...GlobalOption) error
- func (c *Container) Remove(name string)
- func (c *Container) WithContext(ctx context.Context) context.Context
- type Driver
- type DriverEntry
- type GlobalOption
- type HTMLDocument
- type HTMLElement
- type HTMLNode
- type HTMLPage
- type HTTPCookie
- func (c HTTPCookie) Compare(other runtime.Value) int
- func (c HTTPCookie) Copy() runtime.Value
- func (c HTTPCookie) Get(_ context.Context, key runtime.Value) (runtime.Value, error)
- func (c HTTPCookie) Hash() uint64
- func (c HTTPCookie) MarshalJSON() ([]byte, error)
- func (c HTTPCookie) String() string
- func (c HTTPCookie) Type() runtime.Type
- type HTTPCookies
- func (c *HTTPCookies) Copy() runtime.Value
- func (c *HTTPCookies) Get(_ context.Context, key runtime.Value) (runtime.Value, error)
- func (c *HTTPCookies) Hash() uint64
- func (c *HTTPCookies) Iterate(_ context.Context) (runtime.Iterator, error)
- func (c *HTTPCookies) Set(_ context.Context, key, value runtime.Value) error
- func (c *HTTPCookies) SetCookie(cookie HTTPCookie)
- func (c *HTTPCookies) String() string
- func (c *HTTPCookies) Type() runtime.Type
- type HTTPHeaders
- func (h *HTTPHeaders) Clone() *HTTPHeaders
- func (h *HTTPHeaders) Compare(other runtime.Value) int
- func (h *HTTPHeaders) CompareTo(other *HTTPHeaders) int
- func (h *HTTPHeaders) Copy() runtime.Value
- func (h *HTTPHeaders) Get(_ context.Context, key runtime.Value) (runtime.Value, error)
- func (h *HTTPHeaders) Hash() uint64
- func (h *HTTPHeaders) Iterate(_ context.Context) (runtime.Iterator, error)
- func (h *HTTPHeaders) Set(_ context.Context, key, value runtime.Value) error
- func (h *HTTPHeaders) String() string
- func (h *HTTPHeaders) Type() runtime.Type
- type HTTPRequest
- func (req *HTTPRequest) Compare(other runtime.Value) int
- func (req *HTTPRequest) Copy() runtime.Value
- func (req *HTTPRequest) Get(_ context.Context, key runtime.Value) (runtime.Value, error)
- func (req *HTTPRequest) Hash() uint64
- func (req *HTTPRequest) MarshalJSON() ([]byte, error)
- func (req *HTTPRequest) String() string
- func (req *HTTPRequest) Type() runtime.Type
- func (req *HTTPRequest) Unwrap() any
- type HTTPResponse
- func (resp *HTTPResponse) Compare(other runtime.Value) int
- func (resp *HTTPResponse) Copy() runtime.Value
- func (resp *HTTPResponse) Get(_ context.Context, key runtime.Value) (runtime.Value, error)
- func (resp *HTTPResponse) Hash() uint64
- func (resp *HTTPResponse) MarshalJSON() ([]byte, error)
- func (resp *HTTPResponse) String() string
- func (resp *HTTPResponse) Type() runtime.Type
- func (resp *HTTPResponse) Unwrap() any
- type Ignore
- type Option
- func WithCookie(cookie HTTPCookie) Option
- func WithCookies(cookies []HTTPCookie) Option
- func WithCustomName(name string) Option
- func WithHeader(name string, value []string) Option
- func WithHeaders(headers textproto.MIMEHeader) Option
- func WithProxy(address string) Option
- func WithUserAgent(value string) Option
- type Options
- type PDFParams
- type Params
- type ParseParams
- type QuerySelector
- type QuerySelectorKind
- type ResourceFilter
- type SameSite
- type ScreenshotFormat
- type ScreenshotParams
- type ScrollBehavior
- type ScrollHorizontalAlignment
- type ScrollOptions
- type ScrollVerticalAlignment
- type StatusCodeFilter
- type Viewport
- type WaitEvent
Constants ¶
const ( DefaultPageLoadTimeout = 60000 DefaultWaitTimeout = 5000 DefaultKeyboardDelay = 80 DefaultMouseDelay = 40 DefaultTimeout = 30000 )
const ( RequestEvent = "request" ResponseEvent = "response" )
const ( // WaitEventPresence indicating to wait for Value to appear WaitEventPresence = 0 // WaitEventAbsence indicating to wait for Value to disappear WaitEventAbsence = 1 )
Variables ¶
var ( ErrDetached = errors.New("element detached") ErrNotFound = errors.New("element(s) not found") )
var ( HTTPRequestType = runtime.NewTypeFor[*HTTPRequest](pkg, "HTTPRequest") HTTPResponseType = runtime.NewTypeFor[*HTTPResponse](pkg, "HTTPResponse") HTTPHeadersType = runtime.NewTypeFor[*HTTPHeaders](pkg, "HTTPHeaders") HTTPCookieType = runtime.NewTypeFor[*HTTPCookie](pkg, "HTTPCookie") HTTPCookiesType = runtime.NewTypeFor[*HTTPCookies](pkg, "HTTPCookies") HTMLElementType = runtime.NewTypeFor[HTMLElement](pkg, "HTMLElement") HTMLDocumentType = runtime.NewTypeFor[HTMLDocument](pkg, "HTMLDocument") HTMLPageType = runtime.NewTypeFor[HTMLPage](pkg, "HTMLPage") )
Functions ¶
func CompareTypes ¶
func IsScreenshotFormatValid ¶
func NewHTTPHeadersProxy ¶
func NewHTTPHeadersProxy(header *HTTPHeaders) runtime.Value
func WithContext ¶
Types ¶
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
func NewContainer ¶
func NewContainer() *Container
type Driver ¶
type DriverEntry ¶
type DriverEntry struct {
Driver Driver
Options []GlobalOption
}
type GlobalOption ¶
type GlobalOption func(drv Driver, opts *globalOptions)
func AsDefault ¶
func AsDefault() GlobalOption
type HTMLDocument ¶
type HTMLDocument interface {
HTMLNode
GetTitle() runtime.String
GetElement() HTMLElement
GetURL() runtime.String
GetName() runtime.String
GetParentDocument(ctx context.Context) (HTMLDocument, error)
GetChildDocuments(ctx context.Context) (runtime.List, error)
Scroll(ctx context.Context, options ScrollOptions) error
ScrollTop(ctx context.Context, options ScrollOptions) error
ScrollBottom(ctx context.Context, options ScrollOptions) error
ScrollBySelector(ctx context.Context, selector QuerySelector, options ScrollOptions) error
MoveMouseByXY(ctx context.Context, x, y runtime.Float) error
}
func ToDocument ¶
func ToDocument(value runtime.Value) (HTMLDocument, error)
type HTMLElement ¶
type HTMLElement interface {
HTMLNode
GetInnerText(ctx context.Context) (runtime.String, error)
SetInnerText(ctx context.Context, innerText runtime.String) error
GetInnerHTML(ctx context.Context) (runtime.String, error)
SetInnerHTML(ctx context.Context, innerHTML runtime.String) error
GetValue(ctx context.Context) (runtime.Value, error)
SetValue(ctx context.Context, value runtime.Value) error
GetStyles(ctx context.Context) (runtime.Map, error)
GetStyle(ctx context.Context, name runtime.String) (runtime.Value, error)
SetStyles(ctx context.Context, values runtime.Map) error
SetStyle(ctx context.Context, name, value runtime.String) error
RemoveStyle(ctx context.Context, name ...runtime.String) error
GetAttributes(ctx context.Context) (runtime.Map, error)
GetAttribute(ctx context.Context, name runtime.String) (runtime.Value, error)
SetAttributes(ctx context.Context, values runtime.Map) error
SetAttribute(ctx context.Context, name, value runtime.String) error
RemoveAttribute(ctx context.Context, name ...runtime.String) error
GetInnerHTMLBySelector(ctx context.Context, selector QuerySelector) (runtime.String, error)
SetInnerHTMLBySelector(ctx context.Context, selector QuerySelector, innerHTML runtime.String) error
GetInnerHTMLBySelectorAll(ctx context.Context, selector QuerySelector) (runtime.List, error)
GetInnerTextBySelector(ctx context.Context, selector QuerySelector) (runtime.String, error)
SetInnerTextBySelector(ctx context.Context, selector QuerySelector, innerText runtime.String) error
GetInnerTextBySelectorAll(ctx context.Context, selector QuerySelector) (runtime.List, error)
GetPreviousElementSibling(ctx context.Context) (runtime.Value, error)
GetNextElementSibling(ctx context.Context) (runtime.Value, error)
GetParentElement(ctx context.Context) (runtime.Value, error)
Click(ctx context.Context, count runtime.Int) error
ClickBySelector(ctx context.Context, selector QuerySelector, count runtime.Int) error
ClickBySelectorAll(ctx context.Context, selector QuerySelector, count runtime.Int) error
Clear(ctx context.Context) error
ClearBySelector(ctx context.Context, selector QuerySelector) error
Input(ctx context.Context, value runtime.Value, delay runtime.Int) error
InputBySelector(ctx context.Context, selector QuerySelector, value runtime.Value, delay runtime.Int) error
Press(ctx context.Context, keys []runtime.String, count runtime.Int) error
PressBySelector(ctx context.Context, selector QuerySelector, keys []runtime.String, count runtime.Int) error
Select(ctx context.Context, value runtime.List) (runtime.List, error)
SelectBySelector(ctx context.Context, selector QuerySelector, value runtime.List) (runtime.List, error)
ScrollIntoView(ctx context.Context, options ScrollOptions) error
Focus(ctx context.Context) error
FocusBySelector(ctx context.Context, selector QuerySelector) error
Blur(ctx context.Context) error
BlurBySelector(ctx context.Context, selector QuerySelector) error
Hover(ctx context.Context) error
HoverBySelector(ctx context.Context, selector QuerySelector) error
WaitForElement(ctx context.Context, selector QuerySelector, when WaitEvent) error
WaitForElementAll(ctx context.Context, selector QuerySelector, when WaitEvent) error
WaitForAttribute(ctx context.Context, name runtime.String, value runtime.Value, when WaitEvent) error
WaitForAttributeBySelector(ctx context.Context, selector QuerySelector, name runtime.String, value runtime.Value, when WaitEvent) error
WaitForAttributeBySelectorAll(ctx context.Context, selector QuerySelector, name runtime.String, value runtime.Value, when WaitEvent) error
WaitForStyle(ctx context.Context, name runtime.String, value runtime.Value, when WaitEvent) error
WaitForStyleBySelector(ctx context.Context, selector QuerySelector, name runtime.String, value runtime.Value, when WaitEvent) error
WaitForStyleBySelectorAll(ctx context.Context, selector QuerySelector, name runtime.String, value runtime.Value, when WaitEvent) error
WaitForClass(ctx context.Context, class runtime.String, when WaitEvent) error
WaitForClassBySelector(ctx context.Context, selector QuerySelector, class runtime.String, when WaitEvent) error
WaitForClassBySelectorAll(ctx context.Context, selector QuerySelector, class runtime.String, when WaitEvent) error
}
HTMLElement is the most general base interface which most objects in a GetMainFrame implement.
type HTMLNode ¶
type HTMLNode interface {
runtime.Value
runtime.Iterable
runtime.KeyReadable
runtime.KeyWritable
runtime.Measurable
runtime.Queryable
runtime.Dispatchable
io.Closer
GetNodeType(ctx context.Context) (runtime.Int, error)
GetNodeName(ctx context.Context) (runtime.String, error)
GetChildNodes(ctx context.Context) (runtime.List, error)
GetChildNode(ctx context.Context, idx runtime.Int) (runtime.Value, error)
QuerySelector(ctx context.Context, selector QuerySelector) (runtime.Value, error)
QuerySelectorAll(ctx context.Context, selector QuerySelector) (runtime.List, error)
CountBySelector(ctx context.Context, selector QuerySelector) (runtime.Int, error)
ExistsBySelector(ctx context.Context, selector QuerySelector) (runtime.Boolean, error)
XPath(ctx context.Context, expression runtime.String) (runtime.Value, error)
}
HTMLNode is an interface from which a number of DOM API object types inherit. It allows those types to be treated similarly; for example, inheriting the same set of methods, or being tested in the same way.
type HTMLPage ¶
type HTMLPage interface {
runtime.Value
runtime.Iterable
runtime.KeyReadable
runtime.KeyWritable
runtime.Measurable
runtime.Observable
runtime.Dispatchable
io.Closer
IsClosed() runtime.Boolean
GetURL() runtime.String
GetMainFrame() HTMLDocument
GetFrames(ctx context.Context) (runtime.List, error)
GetFrame(ctx context.Context, idx runtime.Int) (runtime.Value, error)
GetCookies(ctx context.Context) (*HTTPCookies, error)
SetCookies(ctx context.Context, cookies *HTTPCookies) error
DeleteCookies(ctx context.Context, cookies *HTTPCookies) error
GetResponse(ctx context.Context) (HTTPResponse, error)
PrintToPDF(ctx context.Context, params PDFParams) (runtime.Binary, error)
CaptureScreenshot(ctx context.Context, params ScreenshotParams) (runtime.Binary, error)
}
HTMLPage interface represents any web page loaded in the browser and serves as an entry point into the web page's content
type HTTPCookie ¶
type HTTPCookie struct {
Name string `json:"name"`
Value string `json:"Value"`
Path string `json:"path"`
Domain string `json:"domain"`
Expires time.Time `json:"expires"`
MaxAge int `json:"maxAge"`
Secure bool `json:"secure"`
HTTPOnly bool `json:"HTTPOnly"`
SameSite SameSite `json:"sameSite"`
}
HTTPCookie HTTPCookie object
func (HTTPCookie) Copy ¶
func (c HTTPCookie) Copy() runtime.Value
func (HTTPCookie) Hash ¶
func (c HTTPCookie) Hash() uint64
func (HTTPCookie) MarshalJSON ¶
func (c HTTPCookie) MarshalJSON() ([]byte, error)
func (HTTPCookie) String ¶
func (c HTTPCookie) String() string
func (HTTPCookie) Type ¶
func (c HTTPCookie) Type() runtime.Type
type HTTPCookies ¶
type HTTPCookies struct {
Data map[string]HTTPCookie
}
func NewHTTPCookies ¶
func NewHTTPCookies() *HTTPCookies
func NewHTTPCookiesFrom ¶
func NewHTTPCookiesFrom(cookies *HTTPCookies) *HTTPCookies
func NewHTTPCookiesWith ¶
func NewHTTPCookiesWith(values map[string]HTTPCookie) *HTTPCookies
func (*HTTPCookies) Copy ¶
func (c *HTTPCookies) Copy() runtime.Value
func (*HTTPCookies) Hash ¶
func (c *HTTPCookies) Hash() uint64
func (*HTTPCookies) SetCookie ¶
func (c *HTTPCookies) SetCookie(cookie HTTPCookie)
func (*HTTPCookies) String ¶
func (c *HTTPCookies) String() string
func (*HTTPCookies) Type ¶
func (c *HTTPCookies) Type() runtime.Type
type HTTPHeaders ¶
type HTTPHeaders struct {
Data textproto.MIMEHeader
}
HTTPHeaders HTTP header object
func NewHTTPHeaders ¶
func NewHTTPHeaders() *HTTPHeaders
func NewHTTPHeadersWith ¶
func NewHTTPHeadersWith(values map[string][]string) *HTTPHeaders
func (*HTTPHeaders) Clone ¶
func (h *HTTPHeaders) Clone() *HTTPHeaders
func (*HTTPHeaders) CompareTo ¶
func (h *HTTPHeaders) CompareTo(other *HTTPHeaders) int
func (*HTTPHeaders) Copy ¶
func (h *HTTPHeaders) Copy() runtime.Value
func (*HTTPHeaders) Hash ¶
func (h *HTTPHeaders) Hash() uint64
func (*HTTPHeaders) String ¶
func (h *HTTPHeaders) String() string
func (*HTTPHeaders) Type ¶
func (h *HTTPHeaders) Type() runtime.Type
type HTTPRequest ¶
type HTTPRequest struct {
URL string
Method string
Headers *HTTPHeaders
Body []byte
}
HTTPRequest HTTP request object.
func (*HTTPRequest) Copy ¶
func (req *HTTPRequest) Copy() runtime.Value
func (*HTTPRequest) Hash ¶
func (req *HTTPRequest) Hash() uint64
func (*HTTPRequest) MarshalJSON ¶
func (req *HTTPRequest) MarshalJSON() ([]byte, error)
func (*HTTPRequest) String ¶
func (req *HTTPRequest) String() string
func (*HTTPRequest) Type ¶
func (req *HTTPRequest) Type() runtime.Type
func (*HTTPRequest) Unwrap ¶
func (req *HTTPRequest) Unwrap() any
type HTTPResponse ¶
type HTTPResponse struct {
URL string
StatusCode int
Status string
Headers *HTTPHeaders
Body []byte
ResponseTime float64
}
HTTPResponse HTTP response object.
func (*HTTPResponse) Copy ¶
func (resp *HTTPResponse) Copy() runtime.Value
func (*HTTPResponse) Hash ¶
func (resp *HTTPResponse) Hash() uint64
func (*HTTPResponse) MarshalJSON ¶
func (resp *HTTPResponse) MarshalJSON() ([]byte, error)
func (*HTTPResponse) String ¶
func (resp *HTTPResponse) String() string
func (*HTTPResponse) Type ¶
func (resp *HTTPResponse) Type() runtime.Type
func (*HTTPResponse) Unwrap ¶
func (resp *HTTPResponse) Unwrap() any
type Ignore ¶
type Ignore struct {
Resources []ResourceFilter `json:"resources"`
StatusCodes []StatusCodeFilter `json:"statusCodes"`
}
type Option ¶
type Option func(opts *Options)
func WithCookie ¶
func WithCookie(cookie HTTPCookie) Option
func WithCookies ¶
func WithCookies(cookies []HTTPCookie) Option
func WithCustomName ¶
func WithHeader ¶
func WithHeaders ¶
func WithHeaders(headers textproto.MIMEHeader) Option
func WithUserAgent ¶
type Options ¶
type Options struct {
Name string `json:"name"`
Proxy string `json:"proxy"`
UserAgent string `json:"userAgent"`
Headers *HTTPHeaders `json:"headers"`
Cookies *HTTPCookies `json:"cookies"`
}
type PDFParams ¶
type PDFParams struct {
// Paper orientation. Defaults to false.
Landscape runtime.Boolean `json:"landscape"`
DisplayHeaderFooter runtime.Boolean `json:"displayHeaderFooter"`
// Print background graphics. Defaults to false.
PrintBackground runtime.Boolean `json:"printBackground"`
// Scale of the webpage rendering. Defaults to 1.
Scale runtime.Float `json:"scale"`
// Paper width in inches. Defaults to 8.5 inches.
PaperWidth runtime.Float `json:"paperWidth"`
// Paper height in inches. Defaults to 11 inches.
PaperHeight runtime.Float `json:"paperHeight"`
// Top margin in inches. Defaults to 1cm (~0.4 inches).
MarginTop runtime.Float `json:"marginTop"`
// Bottom margin in inches. Defaults to 1cm (~0.4 inches).
MarginBottom runtime.Float `json:"marginBottom"`
// Left margin in inches. Defaults to 1cm (~0.4 inches).
MarginLeft runtime.Float `json:"marginLeft"`
// Right margin in inches. Defaults to 1cm (~0.4 inches).
MarginRight runtime.Float `json:"marginRight"`
// Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.
PageRanges runtime.String `json:"pageRanges"`
// HTML template for the print runtime. Should be valid HTML markup with following classes used to inject printing Data into them: - `date`: formatted print date - `title`: document title - `url`: document location - `pageNumber`: current page number - `totalPages`: total pages in the document
// For example, `<span class=title></span>` would generate span containing the title.
HeaderTemplate runtime.String `json:"headerTemplate"`
FooterTemplate runtime.String `json:"footerTemplate"`
// Whether or not to prefer page size as defined by css.
// Defaults to false, in which case the content will be scaled to fit the paper size.
PreferCSSPageSize runtime.Boolean `json:"preferCSSPageSize"`
}
PDFParams represents the arguments for PrintToPDF function.
func NewDefaultHTMLPDFParams ¶
func NewDefaultHTMLPDFParams() PDFParams
type Params ¶
type Params struct {
URL string `json:"url"`
UserAgent string `json:"userAgent"`
KeepCookies bool `json:"keepCookies"`
Cookies *HTTPCookies `json:"cookies"`
Headers *HTTPHeaders `json:"headers"`
Viewport *Viewport `json:"viewport"`
Charset string `json:"charset"`
Ignore *Ignore `json:"ignore"`
}
func SetDefaultParams ¶
type ParseParams ¶
type ParseParams struct {
Content []byte `json:"content"`
KeepCookies bool `json:"keepCookies"`
Cookies *HTTPCookies `json:"cookies"`
Headers *HTTPHeaders `json:"headers"`
Viewport *Viewport `json:"viewport"`
}
type QuerySelector ¶
type QuerySelector struct {
Kind QuerySelectorKind `json:"Kind"`
Value runtime.String `json:"Value"`
}
func NewCSSSelector ¶
func NewCSSSelector(value runtime.String) QuerySelector
func NewXPathSelector ¶
func NewXPathSelector(value runtime.String) QuerySelector
func ToQuerySelector ¶
func ToQuerySelector(value runtime.Value) (QuerySelector, error)
func (QuerySelector) MarshalJSON ¶
func (q QuerySelector) MarshalJSON() ([]byte, error)
func (QuerySelector) String ¶
func (q QuerySelector) String() string
type QuerySelectorKind ¶
type QuerySelectorKind int
const ( UnknownSelector QuerySelectorKind = iota CSSSelector XPathSelector )
func (QuerySelectorKind) String ¶
func (v QuerySelectorKind) String() string
type ResourceFilter ¶
type ScreenshotFormat ¶
type ScreenshotFormat string
ScreenshotFormat represents the format of a screenshot.
const ( // ScreenshotFormatPNG represents the PNG format for screenshots. ScreenshotFormatPNG ScreenshotFormat = "png" // ScreenshotFormatJPEG represents the JPEG format for screenshots. ScreenshotFormatJPEG ScreenshotFormat = "jpeg" )
Screenshot formats.
type ScreenshotParams ¶
type ScreenshotParams struct {
X runtime.Float
Y runtime.Float
Width runtime.Float
Height runtime.Float
Format ScreenshotFormat
Quality runtime.Int
}
ScreenshotParams defines parameters for the screenshot function.
type ScrollBehavior ¶
type ScrollBehavior string
ScrollBehavior defines the transition animation. In HTML specification, default Value is auto, but in Ferret it's instant. More details here https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
const ( ScrollBehaviorInstant ScrollBehavior = "instant" ScrollBehaviorSmooth ScrollBehavior = "smooth" ScrollBehaviorAuto ScrollBehavior = "auto" )
func NewScrollBehavior ¶
func NewScrollBehavior(value string) ScrollBehavior
func (ScrollBehavior) MarshalJSON ¶
func (b ScrollBehavior) MarshalJSON() ([]byte, error)
func (ScrollBehavior) String ¶
func (b ScrollBehavior) String() string
type ScrollHorizontalAlignment ¶
type ScrollHorizontalAlignment string
ScrollHorizontalAlignment defines horizontal alignment after scrolling. In HTML specification, default Value is nearest, but in Ferret it's center. More details here https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
const ( ScrollHorizontalAlignmentCenter ScrollHorizontalAlignment = "center" ScrollHorizontalAlignmentStart ScrollHorizontalAlignment = "start" ScrollHorizontalAlignmentEnd ScrollHorizontalAlignment = "end" ScrollHorizontalAlignmentNearest ScrollHorizontalAlignment = "nearest" )
func NewScrollHorizontalAlignment ¶
func NewScrollHorizontalAlignment(value string) ScrollHorizontalAlignment
func (ScrollHorizontalAlignment) MarshalJSON ¶
func (a ScrollHorizontalAlignment) MarshalJSON() ([]byte, error)
func (ScrollHorizontalAlignment) String ¶
func (a ScrollHorizontalAlignment) String() string
type ScrollOptions ¶
type ScrollOptions struct {
Top runtime.Float `json:"top"`
Left runtime.Float `json:"left"`
Behavior ScrollBehavior `json:"behavior"`
Block ScrollVerticalAlignment `json:"block"`
Inline ScrollHorizontalAlignment `json:"inline"`
}
ScrollOptions defines how scroll animation should be performed.
type ScrollVerticalAlignment ¶
type ScrollVerticalAlignment string
ScrollVerticalAlignment defines vertical alignment after scrolling. In HTML specification, default Value is start, but in Ferret it's center. More details here https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
const ( ScrollVerticalAlignmentCenter ScrollVerticalAlignment = "center" ScrollVerticalAlignmentStart ScrollVerticalAlignment = "start" ScrollVerticalAlignmentEnd ScrollVerticalAlignment = "end" ScrollVerticalAlignmentNearest ScrollVerticalAlignment = "nearest" )
func NewScrollVerticalAlignment ¶
func NewScrollVerticalAlignment(value string) ScrollVerticalAlignment
func (ScrollVerticalAlignment) MarshalJSON ¶
func (a ScrollVerticalAlignment) MarshalJSON() ([]byte, error)
func (ScrollVerticalAlignment) String ¶
func (a ScrollVerticalAlignment) String() string