Sha256: e26af54805e1c851a96a24796006f17d5dd8d9a26cc0251065916613320ff73f

Contents?: true

Size: 438 Bytes

Versions: 35

Compression:

Stored size: 438 Bytes

Contents

_.each(["Model", "Collection"], function(name) {
  // Cache Backbone constructor.
  var ctor = Backbone[name];
  // Cache original fetch.
  var fetch = ctor.prototype.fetch;

  // Override the fetch method to emit a fetch event.
  ctor.prototype.fetch = function() {
    // Trigger the fetch event on the instance.
    this.trigger("fetch", this);

    // Pass through to original fetch.
    return fetch.apply(this, arguments);
  };
});

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
iugu-ux-1.0.5 vendor/assets/javascripts/vendor/backbone.fetch-event.js
iugu-ux-1.0.4 vendor/assets/javascripts/vendor/backbone.fetch-event.js
iugu-ux-1.0.3 vendor/assets/javascripts/vendor/backbone.fetch-event.js
iugu-ux-1.0.2 vendor/assets/javascripts/vendor/backbone.fetch-event.js
iugu-ux-1.0.1 vendor/assets/javascripts/vendor/backbone.fetch-event.js
iugu-ux-1.0.0 vendor/assets/javascripts/vendor/backbone.fetch-event.js
iugu-ux-0.9.9 vendor/assets/javascripts/vendor/backbone.fetch-event.js
iugu-ux-0.9.8 vendor/assets/javascripts/vendor/backbone.fetch-event.js
iugu-ux-0.9.5 vendor/assets/javascripts/vendor/backbone.fetch-event.js
iugu-ux-0.9.4 vendor/assets/javascripts/vendor/backbone.fetch-event.js
iugu-ux-0.9.3 vendor/assets/javascripts/vendor/backbone.fetch-event.js
iugu-ux-0.9.2 vendor/assets/javascripts/vendor/backbone.fetch-event.js
iugu-ux-0.9.1 vendor/assets/javascripts/vendor/backbone.fetch-event.js
iugu-ux-0.9.0 vendor/assets/javascripts/vendor/backbone.fetch-event.js
iugu-ux-0.8.9 vendor/assets/javascripts/vendor/backbone.fetch-event.js