Interface TableViewportSubscription

Encapsulates event handling around table subscriptions by "cheating" and wrapping up a JsTable instance to do the real dirty work. This allows a viewport to stay open on the old table if desired, while this one remains open.

As this just wraps a JsTable (and thus a CTS), it holds its own flattened, pUT'd handle to get deltas from the server. The setViewport method can be used to adjust this table instead of creating a new one.

Existing methods on JsTable like setViewport and getViewportData are intended to proxy to this, which then will talk to the underlying handle and accumulated data.

As long as we keep the existing methods/events on JsTable, close() is not required if no other method is called, with the idea then that the caller did not actually use this type. This means that for every exported method (which then will mark the instance of "actually being used, please don't automatically close me"), there must be an internal version called by those existing JsTable method, which will allow this instance to be cleaned up once the JsTable deems it no longer in use.

Note that if the caller does close an instance, this shuts down the JsTable's use of this (while the converse is not true), providing a way to stop the server from streaming updates to the client.

This object serves as a "handle" to a subscription, allowing it to be acted on directly or canceled outright. If you retain an instance of this, you have two choices - either only use it to call close() on it to stop the table's viewport without creating a new one, or listen directly to this object instead of the table for data events, and always call close() when finished. Calling any method on this object other than close() will result in it continuing to live on after setViewport is called on the original table, or after the table is modified.

Hierarchy

Methods

  • Listen for events on this object.

    Type Parameters

    • T

      the type of the data that the event will provide

    Parameters

    • name: string

      the name of the event to listen for

    • callback: ((e) => void)

      a function to call when the event occurs

        • (e): void
        • Parameters

          • e: CustomEvent<T>

          Returns void

    Returns (() => void)

    Returns a cleanup function.

      • (): void
      • Listen for events on this object.

        Returns void

        Returns a cleanup function.

  • Stops this viewport from running, stopping all events on itself and on the table that created it.

    Returns void

  • Gets the data currently visible in this viewport

    Returns Promise<TableData>

    Promise of TableData.

  • Type Parameters

    • T

    Parameters

    • eventName: string
    • Optional timeoutInMillis: number

    Returns Promise<CustomEvent<T>>

  • Removes an event listener added to this table.

    Type Parameters

    • T

    Parameters

    • name: string
    • callback: ((e) => void)
        • (e): void
        • Parameters

          • e: CustomEvent<T>

          Returns void

    Returns boolean

  • Changes the rows and columns set on this viewport. This cannot be used to change the update interval.

    Parameters

    • firstRow: number
    • lastRow: number
    • Optional columns: Column[]
    • Optional updateIntervalMs: number

    Returns void