MCPcopy
hub / github.com/jupyter-widgets/ipywidgets / IWidgetManager

Interface IWidgetManager

packages/base/src/manager.ts:117–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115 * The widget manager interface exposed on the Widget instances
116 */
117export interface IWidgetManager {
118 /**
119 * Get a promise for a model by model id.
120 *
121 * #### Notes
122 * If a model is not found, undefined is returned (NOT a promise). However,
123 * the calling code should also deal with the case where a rejected promise
124 * is returned, and should treat that also as a model not found.
125 */
126 get_model(model_id: string): Promise<WidgetModel>;
127
128 /**
129 * Returns true if the given model is registered, otherwise false.
130 *
131 * #### Notes
132 * This is a synchronous way to check if a model is registered.
133 */
134 has_model(model_id: string): boolean;
135
136 /**
137 * Register a model instance promise with the manager.
138 *
139 * By registering the model, it can later be retrieved with `get_model`.
140 */
141 register_model(model_id: string, modelPromise: Promise<WidgetModel>): void;
142
143 /**
144 * Create a comm and new widget model.
145 * @param options - same options as new_model but comm is not
146 * required and additional options are available.
147 * @param serialized_state - serialized model attributes.
148 */
149 new_widget(
150 options: IWidgetOptions,
151 serialized_state?: JSONObject
152 ): Promise<WidgetModel>;
153
154 /**
155 * Create and return a promise for a new widget model
156 *
157 * @param options - the options for creating the model.
158 * @param serialized_state - attribute values for the model.
159 *
160 * @example
161 * widget_manager.new_model({
162 * model_name: 'IntSlider',
163 * model_module: '@jupyter-widgets/controls',
164 * model_module_version: '1.0.0',
165 * model_id: 'u-u-i-d'
166 * }).then((model) => { console.log('Create success!', model); },
167 * (err) => {console.error(err)});
168 *
169 */
170 new_model(
171 options: IModelOptions,
172 serialized_state?: JSONObject
173 ): Promise<WidgetModel>;
174

Callers 51

renderModelMethod · 0.65
unpack_modelsFunction · 0.65
manager_test.tsFile · 0.65
_loadFromKernelFunction · 0.65
set_stateFunction · 0.65
renderFunction · 0.65
renderModelMethod · 0.65
index.tsFile · 0.65
renderModelMethod · 0.65
manager_test.tsFile · 0.65
_loadFromKernelFunction · 0.65
_loadFromKernelModelsFunction · 0.65

Implementers 1

DummyManagerpackages/base/test/src/dummy-manager.t

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…