AutoPage Command (APL 2023.1 to 2023.2)


Automatically progress through a series of pages displayed in a Pager component. The AutoPage command finishes after the last page has been displayed for the requested amount of time.

Properties

The AutoPage command has the properties shown in the following table, in addition to the common command properties. Set the type property to AutoPage.

In the following table, the "Default" column shows "Required" for properties that must have a value for the command to run. Otherwise it displays the default value, which might be none.

Property Type Default Description

componentId

Selector

:source

The Pager component to page through.

count

Integer

All pages in the pager

The number of pages to display.

duration

Integer

0

The amount of time in milliseconds to wait after advancing to the next page.

For example, to auto page through a Pager called mySportsPager:

  {
    "type": "AutoPage",
    "componentId": "mySportsPager",
    "duration": 1000,
    "delay": 500
  }

This example does the following:

  • Pauses for 500 milliseconds for the delay property.
  • Advances to the next page and pauses for 1000 milliseconds for the duration property.
  • Continues to advance and pause until the final pause has completed.

For example, assume mySportsPager has three pages and initially displays page 1. AutoPage does the following:

  • Displays the first page for 500 ms for the delay.
  • Changes to the second page and pauses for 1000 ms.
  • Changes to the third and pauses for 1000 ms.

At this point the command is complete. Therefore, the Pager continues to display page three until another command or event causes a change.

The AutoPage command has no effect if the count is non-positive.

The AutoPage command does the following when it stops:

  • Moves the display ahead to the target page if the AutoPage command sequence is at least 50 percent complete.
  • Returns the display to the previous page if it isn't at least 50 percent complete.

The onPageChanged command runs one time with the new page if the page has changed

The AutoPage command is ignored in fast mode.

componentId

A selector that identifies the Pager component for the command. When not provided, defaults to :source. The :source selector targets the component that issued the AutoPage command.

count

The number of pages to display. If not specified, this defaults to the number of pages remaining. Wrapping isn't supported. The count is internally clipped to fall in the range [0, pager.children.length - pager.currentIndex - 1].

duration

The amount of time to wait after advancing to the next page. Any animated transition between pages isn't included in the duration and therefore increases the overall command run time.

Because the duration applies after advancing to the next page, it doesn't apply to the first page of the pager. To delay the start of paging, use the standard command delay property.

Reinflation strategy

When the Reinflate command runs, the AutoPage command can resume after Alexa reinflates the document. The command resumes when it runs on a sequencer that's specified in the preservedSequencers array on Reinflate.

If the target component isn't a Pager in the reinflated hierarchy, the command is ignored.

If a page transition is running when the reinflation occurs, the command continues from the preserved position (if any) or 0 when reinflation completes.

To continue AutoPage from the same page where the command paused, explicitly preserve the pageIndex with the Pager preserve property.

AutoPage example

The following example shows the AutoPage command. Click the Start AutoPage button to run the command. The progress bar shows the approximate time remaining based on the number of pages in the pager and the delay and duration properties in the command. After the AutoPage completes, the example resets the pager to the first page. The delay and duration values for this example are set in the data source.



Was this page helpful?

Last updated: frontmatter-missing