items(container, [cb])

Returns a collection of all page items in the given container. The container object can be a Document, Page, Layer, Group, Story, Page Item or Text Object. If a callback function is given, items() calls this callback function on each page item of the given container. When the callback function returns false, the loop stops and the items() function returns an array of all page items up to this point.

Type: function

Parameter(s):

  • container {Document | Page | Layer | Group | Story | PageItem | TextObject}:

    The document, page, layer, group, story, page item or text object instance to iterate the page items in.

  • cb {Function} Optional:

    Optional: The callback function to call with each page item. When this function returns false the loop stops. Passed arguments: item, loopCount

Returns:

  • {PageItems | Array}:

    A collection or an array of page items.