@express-document-sdk / PageList
PageList represents an ordered list of PageNodes, all of which are children of the root node of the document’s “scenegraph” artwork tree (see ExpressRootNode). A page contains one or more artboards, representing “scenes” in a linear timeline sequence. Those artboards, in turn, contain all the visual content of the document.
PageList also provides APIs for adding/removing pages from the document. PageList is never empty: it is illegal to remove the last remaining page from the list.
• get first(): undefined | T
First item in this list, or undefined if list is empty.
undefined | T
• get last(): undefined | T
Last item in this list, or undefined if list is empty.
undefined | T
• get length(): number
Number of items in this list.
number
[iterator]()• [iterator](): Iterator<PageNode, any, any>
Iterates over all the items in this list. Mutations that occur mid-iteration are not reflected by the iterator.
Iterator<PageNode, any, any>
• addPage(inputGeometry): PageNode
Create a new page containing a single empty artboard, and add it to the end of the list. The artboard is configured with the same defaults as in ArtboardList.addArtboard. The page’s artboard becomes the default target for newly inserted content (Context.insertionParent) and the viewport switches to display this artboard.
• inputGeometry: RectangleGeometry
• indexOf(item): number
Get index of item in list.
• item: PageNode
number
index number, or -1 if item isn’t in this list.
• item(index): undefined | PageNode
Returns item at the given index, or undefined if index is out of range.
• index: number
Zero-based index
undefined | PageNode
• moveAfter(item, after): void
Move item so it is immediately after after in this list: places item at the index one higher than after.
Depending on the position in the list item originally occupied, some other items in the list may shift to higher
or lower indices as a result. No-op if both arguments are the same item.
• item: PageNode
• after: PageNode
void
An error if either argument is not contained in this list.
• moveBefore(item, before): void
Move item so it is immediately before before in this list: places item at the index that before used
to occupy. Depending on the position in the list item originally occupied, some other items in the list may
shift to higher or lower indices as a result. No-op if both arguments are the same item.
• item: PageNode
• before: PageNode
void
An error if either argument is not contained in this list.
• remove(…items): void
Remove the items from the list. The items need not be contiguous.
• …items: PageNode[]
void
If any of the items are not in the list, or if it is illegal to remove any of the items from this parent.
• toArray(): readonly PageNode[]
All items in the list, as a static array. Mutations that occur later are not reflected in an array returned earlier.
readonly PageNode[]