Sha256: af2c8ae002a83eef4f6164bc85029b0cefe182b059310cf126a9d72b80a8b8c2

Contents?: true

Size: 462 Bytes

Versions: 3

Compression:

Stored size: 462 Bytes

Contents

Support.Observer = function() {};

_.extend(Support.Observer.prototype, {
  bindTo: function(source, event, callback) {
    source.bind(event, callback, this);
    this.bindings = this.bindings || [];
    this.bindings.push({ source: source, event: event, callback: callback });
  },

  unbindFromAll: function() {
    _.each(this.bindings, function(binding) {
      binding.source.unbind(binding.event, binding.callback);
    });
    this.bindings = []
  }
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
backbone-support-0.4.0 lib/assets/javascripts/backbone-support/observer.js
backbone-support-0.3.2 lib/assets/javascripts/backbone-support/observer.js
backbone-support-0.3.1 lib/assets/javascripts/backbone-support/observer.js