Listen for events on this object.
the type of the data that the event will provide
the name of the event to listen for
a function to call when the event occurs
Returns a cleanup function.
Listen for events on this object.
Returns a cleanup function.
Changes the rows and columns set on this viewport. This cannot be used to change the update interval.
Optional columns: Column[]Optional updateIntervalMs: number
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 callclose()when finished. Calling any method on this object other than close() will result in it continuing to live on aftersetViewportis called on the original table, or after the table is modified.