| 115 | * The widget manager interface exposed on the Widget instances |
| 116 | */ |
| 117 | export 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 |
no outgoing calls
no test coverage detected
searching dependent graphs…