DataTable

Instance methods:

Static properties:

Instance Methods

constructor: DataTable(credentials, id)

Arguments

  1. credentials (Credentials): Valid credentials corresponding to the current user
  2. id (String): The data table's ID. Currently, each data table uses its parent project's ID.

Returns

(DataTable) A DataTable instance

fetchCapability()

Returns

TODO

getCell(cellId)

See Cell#constructor

new DataTable(credentials, dataTableId).getCell(cellId)

is equivalent to

new Cell(credentials, dataTableId, cellId)

fetchCell(cellId)

See Cell#fetch

new DataTable(credentials, dataTableId).fetchCell(cellId)

is equivalent to

new Cell(credentials, dataTableId, cellId).fetch()

listCells()

See Cell#listCells

new DataTable(credentials, dataTableId).listCells()

is equivalent to

Cell.listCells(credentials, dataTableId)

createCell(label, options)

See Cell#createCell

new DataTable(credentials, id).createCell(label, options)

is equivalent to

Cell.createCell(credentials, id, label, options)

openWebSocket(options)

Opens a web socket that can be used to communicate about the data table's events, such as when cells belonging to the data table are modified.

Arguments

  1. options (Object = { onOpen: Function, onError: Function, pingTimeout: Number, errorTimeout: Number, reconnectDelay: Number, delayMultiplier: Number })

    onOpen: A callback that will be triggered when the web socket connects or reconnects

    onError: A callback that will be triggered when the web socket fails to connect or reconnect after a certain time (the errorTimeout). For example, you may want to tell the user to check the Internet connection. If an onError callback is not provided, this will throw an error.

    pingTimeout (default: 30000): How long to wait before reconnecting if the server does not send a PING message

    errorTimeout (default: 600000): How long to wait after the first connection failure before calling the onError callback

    reconnectDelay (default: 5000): How long to wait between attempts to reconnect. This will be multiplied by the delayMultiplier after each failed attempt

    delayMultiplier (default: 1.2): How much to increase the delay each time there is a failed connection attempt

closeWebSocket(removeHandlers)

Closes the web socket, if a web socket has been opened for the data table.

Arguments

  1. removeHandlers (Boolean): Whether the registered handlers for the data table's web socket should be reset. If true, the handlers will no longer be called if and when the data table's web socket is reopened.

addWebSocketHandler(handler,s [notificationTypes])

Adds a handler that will be called when the data table's web socket receives a new message.

The web socket must be opened separately. Handlers are maintained if and when the web socket is closed and reopened.

Arguments

  1. handler (Function): The handler to be called when the web socket receives a relevant message type
  2. notificationTypes (String | String[] - default: DATA_TABLE_ALL): The type or types of notifications that should trigger the handler. If DATA_TABLE_ALL and another type are both supplied, the handler will be triggered multiple times - once per requested type.

Handlers will be called with serialized messages. Handlers registered with specific notification types receive just the body value of the payload. Handlers registered with DATA_TABLE_ALL receive the full payload, including type and body.

removeWebSocketHandler(handler, [notificationTypes])

Removes a handler, such that it will no longer be called when the data table's web socket receives messages.

Arguments

  1. handler (Function): The handler to be removed
  2. notificationTypes (String | String[]): The type or types of notifications for which the handler should no longer be called. If no types are supplied, the handler will be removed completely.

removeWebSocketHandlers([notificationTypes])

Removes all handlers, or all handlers of the specified notification type(s), such that the handlers will no longer be called when the data table's web socket receives messages.

Arguments

  1. ?notificationTypes (String | String[]): The type or types of notifications for which handlers should no longer be called. If no types are supplied, all handlers will be removed completely.

sendmessage(message)

Sends a message to the data table's web socket.

The web socket must be opened separately. sendMessage will raise an error if the web socket has not been opened yet.

Arguments

  1. message (Object | String | Number): The message to be sent

Static Properties

serializeMessage

TODO

constants

TODO

results matching ""

    No results matching ""