detach

detaches a handler from an event (which was attached before by the on() method)

void detach(string name, [any context] );

Parameters

namestringthe name of event to detach
contextanya context marker

Example

diagram.events.on("ShapeClick", function(id) {
    alert("You've just clicked an item with id="+id);
});
 
diagram.events.detach("ShapeClick");

Details

By default detach() removes all event handlers from the target event. You can detach particular event handlers by using the context marker.

var marker = "any"; // you can use any string|object value
 
diagram.events.on("ShapeClick", handler1);
diagram.events.on("ShapeClick", handler2, marker);
// the next command will delete only handler2
diagram.events.detach("ShapeClick", marker);
See also
  • API
  • Back to top