When I try to construct a class that extends WidgetType, it kills the program. If I construct the class without extending WidgetType, the error goes away. Any idea what could cause this? Here’s my widget type.
class IconWidget extends WidgetType
{
public icon: any;
constructor(icon: any)
{
super();
this.icon = icon;
}
public toDOM(view: EditorView): HTMLElement
{
let element = document.createElement('span');
element.classList.add(this.icon);
return element;
}
}
What does ‘killing the program’ mean? Does it throw, does it lock up? I can’t see anything special about the class (and WidgetType itself is pretty unspectacular as well), and if I run this code nothing out of the ordinary happens, so I don’t have any suggestions.
Execution stops at the line where I try to instantiate the class. If I remove the WidgetType inheritance, it moves past that line. It doesn’t seem to throw an error in the console which definitely seems weird.