1
0
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:
Tim Voronov
2020-04-25 15:06:00 -04:00
committed by GitHub
parent 64fc010e6e
commit c9dfb79641
13 changed files with 419 additions and 100 deletions

View File

@ -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)
}