diff -r 8f928cee01e5 -r 7349063b19d8 svghmi/widget_button.ysl2 --- a/svghmi/widget_button.ysl2 Wed May 13 14:48:52 2020 +0200 +++ b/svghmi/widget_button.ysl2 Thu May 14 09:24:09 2020 +0200 @@ -1,18 +1,20 @@ // widget_button.ysl2 -template "widget[@type='Button']", mode="widget_defs" { - param "hmi_element"; - | frequency: 5, - | init: function() { - | this.element.addEventListener( - | "mousedown", - | evt => { - | change_hmi_value(this.indexes[0], "=1"); - | }); - | this.element.addEventListener( - | "mouseup", - | evt => { - | change_hmi_value(this.indexes[0], "=0"); - | }); - | }, -} \ No newline at end of file +template "widget[@type='Button']", mode="widget_class" + || + class ButtonWidget extends Widget{ + frequency = 5; + init() { + this.element.addEventListener( + "mousedown", + evt => { + change_hmi_value(this.indexes[0], "=1"); + }); + this.element.addEventListener( + "mouseup", + evt => { + change_hmi_value(this.indexes[0], "=0"); + }); + } + } + ||