mirror of
https://github.com/MontFerret/ferret.git
synced 2025-07-05 00:49:00 +02:00
Added scroll options (#471)
* Added scroll options * Updated dependencies * Updates after code review * Updates after review * Added comments
This commit is contained in:
@ -10,8 +10,9 @@ import (
|
||||
|
||||
// SCROLL_BOTTOM scrolls the document's window to its bottom.
|
||||
// @param doc (HTMLDocument) - Target document.
|
||||
// @param options (ScrollOptions) - Scroll options. Optional.
|
||||
func ScrollBottom(ctx context.Context, args ...core.Value) (core.Value, error) {
|
||||
err := core.ValidateArgs(args, 1, 1)
|
||||
err := core.ValidateArgs(args, 1, 2)
|
||||
|
||||
if err != nil {
|
||||
return values.None, err
|
||||
@ -23,5 +24,15 @@ func ScrollBottom(ctx context.Context, args ...core.Value) (core.Value, error) {
|
||||
return values.None, err
|
||||
}
|
||||
|
||||
return values.None, doc.ScrollBottom(ctx)
|
||||
var opts drivers.ScrollOptions
|
||||
|
||||
if len(args) > 1 {
|
||||
opts, err = toScrollOptions(args[1])
|
||||
|
||||
if err != nil {
|
||||
return values.None, err
|
||||
}
|
||||
}
|
||||
|
||||
return values.None, doc.ScrollBottom(ctx, opts)
|
||||
}
|
||||
|
Reference in New Issue
Block a user