You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/migration_guides.md
+26-7
Original file line number
Diff line number
Diff line change
@@ -88,7 +88,7 @@ The ``DOMWidgetView.pWidget`` property has been renamed ``DOMWidgetView.luminoWi
88
88
+ this.luminoWidget
89
89
```
90
90
91
-
The ``DOMWidgetView.processPhosphorMessage`` method has been renamed ``DOMWidgetView.processLuminoMessage``. If you want to support both ipywidgets 7.x and 8.x, you should implement both methods:
91
+
The ``DOMWidgetView.processPhosphorMessage`` method has been renamed ``DOMWidgetView.processLuminoMessage``. If you want to support both ipywidgets 7.x and 8.x, you should implement both methods and call the correct super method:
92
92
93
93
```diff
94
94
- processPhosphorMessage(msg: Message): void {
@@ -109,15 +109,15 @@ The ``DOMWidgetView.processPhosphorMessage`` method has been renamed ``DOMWidget
109
109
+ }
110
110
+
111
111
+ processPhosphorMessage(msg: Message): void {
112
-
+ this._processLuminoMessage(msg, (DOMWidgetView as any).processPhosphorMessage);
I you're dropping ipywidgets 7.x support, you can simply rename the `processPhosphorMessage` method into`processLuminoMessage`.
120
+
If you're dropping ipywidgets 7.x support, you can simply rename the `processPhosphorMessage` method to`processLuminoMessage`.
121
121
122
122
#### Widget manager import
123
123
@@ -128,7 +128,7 @@ As mentioned before, if you depend on the ``ManagerBase`` class, you will **eith
128
128
+ import { ManagerBase } from '@jupyter-widgets/base-manager';
129
129
```
130
130
131
-
**or**, siwtch to using the new `IWidgetManager` interface in the `base` package:
131
+
**or**, switch to using the new `IWidgetManager` interface in the `base` package:
132
132
133
133
```diff
134
134
- import { ManagerBase } from '@jupyter-widgets/base';
@@ -153,7 +153,7 @@ export async function myDeserializer(
153
153
154
154
#### Backbone extend
155
155
156
-
The version of backbone that ipywidgets depend on has changed from 1.2.3 to 1.4.0. If you were extending the base widget model with `var CustomWidgetModel = Widget.extend({ ... });` you will need to update the class definition using the ES6 notation:
156
+
The version of [Backbone.js](https://backbonejs.org/) that ipywidgets depends on has changed from 1.2.3 to 1.4.0. If you were extending the base widget model with `var CustomWidgetModel = Widget.extend({ ... });` you will need to update the class definition using the ES6 notation:
157
157
158
158
```diff
159
159
- var CustomWidgetModel = Widget.extend({
@@ -164,8 +164,27 @@ The version of backbone that ipywidgets depend on has changed from 1.2.3 to 1.4.
164
164
+ }
165
165
```
166
166
167
-
Note: If you were relying on setting certain instance attributes via the `extend` method, you might now need override the `preinitialize` method in order for their values to be set in time.
167
+
#### Custom tag names
168
168
169
+
If you were changing the base HTML tag for your widget by defining the `tagName` property, this can now be done in ipywidgets 8 in the `preinitialize` method (see https://github.com/jupyter-widgets/ipywidgets/commit/a342e0dbc7c779bb668e5a21c097d7cec9a6ac44 for example changes in core widgets):
170
+
171
+
```diff
172
+
- get tagName() {
173
+
- return 'button';
174
+
- }
175
+
+ preinitialize() {
176
+
+ this.tagName = 'button';
177
+
+ }
178
+
```
179
+
180
+
If you need compatibility with ipywidgets 7, continue using the `get tagName` accessor instead of `preinitialize`. However, newer versions of Typescript will complain that you are overriding a property with a function. If you want to maintain compatibility with both ipywidgets 7 and ipywidgets 8, and you are using Typescript, you can add a `ts-ignore` directive to mollify Typescript, like is done in [ipydatawidgets](https://github.com/vidartf/ipydatawidgets/blob/489586982c375c03d5ffd3089dd4f427c8266443/packages/jupyter-datawidgets/src/media.ts#L131):
0 commit comments