Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IExternalPartRenderer

Generic interface for an external part renderer.

export
interface

IExternalPartRenderer

remarks

Sometimes, it's inconvenient to force the use of parts wholesale. (For instance, it's nice to be able to stick Markdown() directly into a dashboard, instead of writing an inline PythonPart.). To support this use case without complicating the Dashboard API, consumers can supply some 'renderer' for these external parts that will handle rendering, construction (deserialization), and serialization.

Note that external parts cannot utilize the rest of the Dashboard framework- Globals, bindings, etc. are completely off-limits. The idea is that external parts should be reasonably static and straight-forward.

Hierarchy

  • IDisposable
    • IExternalPartRenderer

Implemented by

Index

Properties

isDisposed

isDisposed: boolean

Test whether the object has been disposed.

Notes

This property is always safe to access.

Methods

dispose

  • dispose(): void
  • Dispose of the resources held by the object.

    Notes

    If the object's dispose method is called more than once, all calls made after the first will be a no-op.

    Undefined Behavior

    It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.

    Returns void

getAllPartIds

  • getAllPartIds(): IterableIterator<string>
  • Get the IDs of all parts this renderer is managing

    Returns IterableIterator<string>

getMetadata

  • getMetadata(): object[]
  • Return info on the available parts, for use in a palette.

    Returns object[]

getPartById

  • getPartById(id: string): Widget | null
  • Get a single part from the renderer.

    Parameters

    • id: string

      The unique ID provided to this renderer in #renderModel

    Returns Widget | null

    The widget to display, or null

renderModel

  • renderModel(model: JSONObject, metadata: JSONValue | undefined, id: string): Promise<void>
  • Render a serialized model into a Phosphor widget.

    remarks

    The model is provided by the serialized Dashboard JSON, and is not strictly typed.

    If your external part doesn't use Phosphor, you still need to wrap the part in a Phosphor widget.

    Parameters

    • model: JSONObject

      The JSON model encountered in deserialization

    • metadata: JSONValue | undefined

      Metadata that was included with this part definition

    • id: string

      The ID that the framework is assigning to this widget

    Returns Promise<void>

    A valid widget

serializePart

  • serializePart(id: string): [JSONObject, JSONValue]
  • Serialize the part using a previously-given ID

    Parameters

    • id: string

      The id of the part assigned by the framework

    Returns [JSONObject, JSONValue]

    A [data, metadata] JSON tuple

Generated using TypeDoc