Skip to content

Conversation

@Nour-Cheour10
Copy link
Contributor

No description provided.

_view_name = Unicode('ImageOverlayView').tag(sync=True)
_model_name = Unicode('ImageOverlayModel').tag(sync=True)

overlay_type = Unicode('image').tag(sync=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we don't need the overlay_type anymore

Comment on lines +40 to +41
this.element = document.createElement('img');
super.render();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works, but the rule should be to always call super first.

I am actually surprised TypeScript is not complaining here.

The problem is that doing so would break your widget because this.element would not be defined when creating the overlay.

One approach could be to define an abstract createElement method in BaseOverlayView, and all subclasses would need to provide the implementation., then you can call createElement in your BaseOverlayView's createOverlay method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants