Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TriggerClient<SS>

This component renders the main page of the trigger tool. On mount, it fetches a list of events for the given document ID via REST and then immediately subscribes to the * EVENTS channel of the websocket service and all events following that will be delivered on-demand.

param

Document ID of the current session

param

Callback for clearing the session

Type parameters

  • SS

Hierarchy

Index

Constructors

constructor

Properties

context

context: any

props

props: Readonly<object> & Readonly<TriggerClientProps>

refs

refs: object

Type declaration

  • [key: string]: ReactInstance

Private socket

socket: Socket

state

state: Readonly<TriggerClientState>

Methods

Optional UNSAFE_componentWillMount

  • UNSAFE_componentWillMount(): void

Optional UNSAFE_componentWillReceiveProps

  • UNSAFE_componentWillReceiveProps(nextProps: Readonly<TriggerClientProps>, nextContext: any): void

Optional UNSAFE_componentWillUpdate

Optional componentDidCatch

  • componentDidCatch(error: Error, errorInfo: ErrorInfo): void
  • Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.

    Parameters

    • error: Error
    • errorInfo: ErrorInfo

    Returns void

componentDidMount

  • componentDidMount(): void
  • Invoked when the component first mounts. Fetches a first set of events via REST and then subscribes to the websocket channel for updates.

    Returns void

Optional componentDidUpdate

  • Called immediately after updating occurs. Not called for the initial render.

    The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.

    Parameters

    Returns void

Optional componentWillMount

  • componentWillMount(): void

Optional componentWillReceiveProps

  • componentWillReceiveProps(nextProps: Readonly<TriggerClientProps>, nextContext: any): void

componentWillUnmount

  • componentWillUnmount(): void
  • Invoked before the component unmounts. Closes the websocket connection.

    Returns void

Optional componentWillUpdate

Private fetchEvents

  • fetchEvents(): Promise<void>
  • Fetches a list of events from the API and updates the state accordingly. If the request fails, the error condition is set which causes the render method to display an error message.

    Returns Promise<void>

forceUpdate

  • forceUpdate(callBack?: undefined | function): void
  • Parameters

    • Optional callBack: undefined | function

    Returns void

Optional getSnapshotBeforeUpdate

  • Runs before React applies the result of render to the document, and returns an object to be given to componentDidUpdate. Useful for saving things such as scroll position before render causes changes to it.

    Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.

    Parameters

    Returns SS | null

render

  • render(): Element
  • Renders the component

    Returns Element

Private renderMainContent

  • renderMainContent(triggerMode: string): Element
  • Renders the main content of the page depending on various state variables. Depending on the value of triggerMode, renders all events or only abstract ones.

    Parameters

    • triggerMode: string

      Trigger mode. One of trigger or enqueue

    Returns Element

    The list of events, a loading spinner or an error

setState

  • setState<K>(state: function | null | S | object, callback?: undefined | function): void
  • Type parameters

    • K: keyof TriggerClientState

    Parameters

    • state: function | null | S | object
    • Optional callback: undefined | function

    Returns void

Optional shouldComponentUpdate

  • Called to determine whether the change in props and state should trigger a re-render.

    Component always returns true. PureComponent implements a shallow comparison on props and state and returns true if any props or states have changed.

    If false is returned, Component#render, componentWillUpdate and componentDidUpdate will not be called.

    Parameters

    Returns boolean

Private subscribeToEventUpdates

  • subscribeToEventUpdates(): Promise<void>
  • Subscribes to the EVENTS channel of the websocket service to receive event updates. This allows for on-demand updates of the event list without having to explicitly poll for events.

    Returns Promise<void>

Generated using TypeDoc