Collection<T> Class

Serves as a base for classes maintaining a collection of items.

Declaration

export abstract class Collection<T>

Type Parameters

Name Description
T

The type of items.

Properties

count Property

Gets the number of items contained in the collection.

Declaration

readonly count: number

Property Value

Type Description
number

The number of items.

Methods

getByIndex(index) Method

Gets an item with the specified index.

Declaration

getByIndex(
    index: number
): T | null

Parameters

Name Type Description
index number

The index of an item in the collection.

Returns

Type Description
T

An object that is the item at the specified index.

null

An item with the specified index is not found.

Remarks

// Gets URLs of all hyperlinks in the main sub-document
var hyperlinks = richEdit.document.hyperlinks;
var hyperlinkUrls = [];
for(var i = 0, hyperlink; hyperlink = hyperlinks.getByIndex(i); i++)
    if (hyperlink.hyperlinkInfo.url)
        hyperlinkUrls.push(hyperlink.hyperlinkInfo.url);