The widget manager interface exposed on the Widget instances

Hierarchy

  • IWidgetManager

Methods

  • Get a promise for a model by model id.

    Notes

    If a model is not found, undefined is returned (NOT a promise). However, the calling code should also deal with the case where a rejected promise is returned, and should treat that also as a model not found.

    Parameters

    • model_id: string

    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

  • 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: JSONObject

      attribute values for the model.

    Returns Promise<WidgetModel>

  • Register a model instance promise with the manager.

    By registering the model, it can later be retrieved with get_model.

    Parameters

    Returns void

  • Resolve a URL relative to the current notebook location.

    The default implementation just returns the original url.

    Parameters

    • url: string

    Returns Promise<string>

Generated using TypeDoc