4.2.3 Event Handler

4.2.3.1 Execute Events

The execute event handler binds a click handler that executed an event (Event-B) or an operation (Classical-B) on the element(s) that matches the selector. The user can also define a list of events (or operations). In this case, a tooltip that lists the available events (disabled and enabled) will be shown when hovering the matched element. The following options can be passed:

*This attribute also accepts a function that should return its value. The reference to the graphical element that the observer is attached to (origin) is passed to the function.

Example execute event handler:


bms.executeEvent({
  selector: "text[data-some]",
  events: [
    { 
      name: "event1", 
      predicate: function (origin) {
        return "x=" + origin.attr("data-some") 
      }
    },
    { name: "event2", predicate: "y=3" },
    { name: "event3" } 
  ],
  label: function(event, origin) {
     return "<strong>" + event.name + "." + event.predicate + "</strong>";
  }
});