svghmi/widget_back.ysl2
branchsvghmi
changeset 3232 7bdb766c2a4d
parent 2958 895d3f2b1786
child 3241 fe945f1f48b7
equal deleted inserted replaced
3231:5243c2a2f7f8 3232:7bdb766c2a4d
     1 // widget_back.ysl2
     1 // widget_back.ysl2
     2 
     2 
     3 template "widget[@type='Back']", mode="widget_class"
     3 widget_class("Back")
     4     ||
     4     ||
     5     class BackWidget extends Widget{
       
     6         on_click(evt) {
     5         on_click(evt) {
     7             if(jump_history.length > 1){
     6             if(jump_history.length > 1){
     8                jump_history.pop();
     7                jump_history.pop();
     9                let [page_name, index] = jump_history.pop();
     8                let [page_name, index] = jump_history.pop();
    10                switch_page(page_name, index);
     9                switch_page(page_name, index);
    11             }
    10             }
    12         }
    11         }
    13         init() {
    12         init() {
    14             this.element.setAttribute("onclick", "hmi_widgets['"+this.element_id+"'].on_click(evt)");
    13             this.element.setAttribute("onclick", "hmi_widgets['"+this.element_id+"'].on_click(evt)");
    15         }
    14         }
    16     }
       
    17     ||
    15     ||