A widget manager that returns phosphor widgets.

Hierarchy

Constructors

Properties

_context: IContext<INotebookModel>
_kernelRestoreInProgress: boolean = false
_restored: Signal<WidgetManager, void> = ...
_restoredStatus: boolean = false
_settings: Settings
comm_target_name: "jupyter.widget" = "jupyter.widget"

The comm target name to register

Accessors

  • get onUnhandledIOPubMessage(): ISignal<this, IIOPubMessage<IOPubMessageType>>
  • A signal emitted for unhandled iopub kernel messages.

    Returns ISignal<this, IIOPubMessage<IOPubMessageType>>

  • get restored(): ISignal<this, void>
  • A signal emitted when state is restored to the widget manager.

    Notes

    This indicates that previously-unavailable widget models might be available now.

    Returns ISignal<this, void>

Methods

  • Create a comm.

    Parameters

    • target_name: string
    • model_id: string
    • Optional data: any
    • Optional metadata: any
    • Optional buffers: ArrayBuffer[] | ArrayBufferView[]

    Returns Promise<IClassicComm>

  • Old implementation of fetching widget models one by one using the request_state message on each comm.

    This is a utility function that can be used in subclasses.

    Returns Promise<void>

  • Parameters

    • options: RequiredSome<IModelOptions, "model_id">
    • Optional serialized_state: any

    Returns Promise<WidgetModel>

  • Creates a promise for a view of a given model

    Notes

    The implementation must trigger the Lumino 'after-attach' and 'after-show' events when appropriate, which in turn will trigger the view's 'displayed' events.

    Make sure the view creation is not out of order with any state updates.

    Type Parameters

    • VT extends DOMWidgetView<VT> = DOMWidgetView

    Parameters

    • model: DOMWidgetModel
    • Optional options: any

    Returns Promise<VT>

  • Type Parameters

    • VT extends WidgetView<VT> = WidgetView

    Parameters

    • model: WidgetModel
    • Optional options: any

    Returns Promise<VT>

  • Filter serialized widget state to remove any ID's already present in manager.

    Returns

    A copy of the state, with its 'state' attribute filtered

    Parameters

    • serialized_state: any

    Returns any

  • Get a promise for a model by model id.

    Notes

    If the model is not found, the returned Promise object is rejected.

    If you would like to synchronously test if a model exists, use .has_model().

    Parameters

    • model_id: string

    Returns Promise<WidgetModel>

  • Asynchronously get the state of the widget manager.

    This includes all of the widget models, and follows the format given in the @jupyter-widgets/schema package.

    Returns

    Promise for a state dictionary

    Parameters

    • Optional options: IStateOptions

      The options for what state to return.

    Returns Promise<IManagerState>

  • Synchronously get the state of the live widgets in the widget manager.

    This includes all of the live widget models, and follows the format given in the @jupyter-widgets/schema package.

    Returns

    A state dictionary

    Parameters

    • options: IStateOptions = {}

      The options for what state to return.

    Returns ReadonlyPartialJSONValue

  • Handle when a comm is opened.

    Parameters

    • comm: IClassicComm
    • msg: ICommOpenMsg<"iopub" | "shell">

    Returns Promise<WidgetModel>

  • Returns true if the given model is registered, otherwise false.

    Notes

    This is a synchronous way to check if a model is registered.

    Parameters

    • model_id: string

    Returns boolean

  • Parameters

    • source: string

    Returns string

  • Load a class and return a promise to the loaded object.

    Parameters

    • className: string
    • moduleName: string
    • moduleVersion: string

    Returns Promise<typeof WidgetModel | typeof WidgetView>

  • Parameters

    • className: string
    • moduleName: string
    • moduleVersion: string

    Returns Promise<typeof WidgetModel>

  • Parameters

    • className: string
    • moduleName: string
    • moduleVersion: string

    Returns Promise<typeof WidgetView>

  • Create and return a promise for a new widget model

    Example

    widget_manager.new_model({
    model_name: 'IntSlider',
    model_module: '@jupyter-widgets/controls',
    model_module_version: '1.0.0',
    model_id: 'u-u-i-d'
    }).then((model) => { console.log('Create success!', model); },
    (err) => {console.error(err)});

    Parameters

    • options: IModelOptions

      the options for creating the model.

    • Optional serialized_state: any

      attribute values for the model.

    Returns Promise<WidgetModel>

  • Create a comm and new widget model.

    Parameters

    • options: IWidgetOptions

      same options as new_model but comm is not required and additional options are available.

    • Optional serialized_state: JSONObject

      serialized model attributes.

    Returns Promise<WidgetModel>

  • Restore widgets from kernel and saved state.

    Parameters

    • notebook: INotebookModel
    • __namedParameters: {
          loadKernel: boolean;
          loadNotebook: boolean;
      } = ...
      • loadKernel: boolean
      • loadNotebook: boolean

    Returns Promise<void>

  • Modifies view options. Generally overloaded in custom widget manager implementations.

    Parameters

    • Optional options: any

    Returns any

  • Set the widget manager state.

    Parameters

    • state: IManagerState

      a Javascript object conforming to the application/vnd.jupyter.widget-state+json spec.

      Reconstructs all of the widget models in the state, merges that with the current manager state, and then attempts to redisplay the widgets in the state.

    Returns Promise<WidgetModel[]>

Generated using TypeDoc