unbind

  • function
can.Map.prototype.unbind  

Unbind event handlers from an Map.

map.unbind(eventType[, handler])

Parameters

  1. eventType {String}

    the type of event to unbind, exactly as passed to bind

  2. handler {function()}Optional

    the handler to unbind

unbind unbinds event handlers previously bound with [can.Map.prototype.bind|bind]. If no handler is passed, all handlers for the given event type will be unbound.

var i = 0,
    increaseBy2 = function() { i += 2; },
    increaseBy3 = function() { i += 3; },
    o = new can.Map();

o.bind('change', increaseBy2);
o.bind('change', increaseBy3);
o.attr('a', 'Alice');
i; // 5

o.unbind('change', increaseBy2);
o.attr('b', 'Bob');
i; // 8

o.unbind('change');
o.attr('e', 'Eve');
i; // 8