can
Version:
MIT-licensed, client-side, JavaScript framework that makes building rich web applications easy.
32 lines (23 loc) • 852 B
Markdown
Map.prototype.unbind unbind
can.Map.prototype 8
Unbind event handlers from a Map.
`map.unbind(eventType[, handler])`
{String} eventType the type of event to unbind, exactly as passed to `bind`
{Function} [handler] 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
can.