Vertex Viewer SDK
    Preparing search index...

    Class SceneTreeController

    The SceneTreeController is responsible for coordinating interactions of the view, fetching and mutating tree data on the server, maintaining state and notifying the view about state changes.

    Index
    onStateChange: EventDispatcher<SceneTreeState> = ...

    A dispatcher that emits an event whenever the internal state has changed.

    • Invokes a network request that will expand all the parent nodes for the node mapped to the given ID.

      Parameters

      • id: string

        An ID of an item.

      Returns Promise<number>

      A promise that resolves with the index of the node after expansion.

    • Fetches a page at the given index. Once the data has been fetched, the controller will emit an onStateChange event that contains rows with the fetched page. If a page is invalidated before the request completes, the response is ignored.

      If the index is out of range, returns without fetching any data.

      Parameters

      • index: number

        A 0 based index to fetch.

      Returns Promise<void>

    • Fetches pages that contain the given row ranges.

      Parameters

      • startOffset: number

        A start offset, inclusive.

      • endOffset: number

        The end offset, inclusive.

      Returns Promise<void>

    • Returns a list of page indices within a range that have not been loaded.

      Parameters

      • start: number

        The start page index, inclusive.

      • end: number

        The end page index, inclusive.

      Returns number[]

      A list of pages indices that have not been loaded.

    • Clears page data that is outside a given range. Uses a distance algorithm to removes pages that are furthest from either end of the range. This method is useful for clearing out data that is not needed anymore to keep memory pressure in the client low.

      Parameters

      • startPage: number

        The index of the starting page in the range.

      • endPage: number

        The index of the ending page in the range.

      • threshold: number = 0

        A minimum number of pages to keep. No cleanup is performed if the number of fetched pages doesn't meet this threshold.

      Returns void

    • Sets the active rows. Active rows dictate which pages will be refetched when the tree changes.

      Parameters

      • start: number

        The starting row index.

      • end: number

        The ending row index.

      Returns Promise<void>

      A promise that resolves when the first page of data has been loaded.