Sha256: 9ae7d944b175ae1adac62aa521f473bf827d7c0beddf03821c911089573d78a2

Contents?: true

Size: 713 Bytes

Versions: 7

Compression:

Stored size: 713 Bytes

Contents

/*
---

name: Request.Headers

description: Headers of response fire events on request

license: MIT-style license.

requires: 
  - Core/Request
  
extends: Core/Request

provides: 
  - Request.Headers

...
*/

(function() {
  
var Headers = Request.Headers = {};

Request.defineHeader = function(header, value) {
  Headers[header] = value || true;
};

Request.prototype.addEvent('complete', function() {
  for (var header in Headers) {
    var value = this.getHeader(header);
    if (value) {
      var args = Array.concat(value, arguments);
      this.fireEvent(header.camelCase(), args);
      var callback = Headers[header];
      if (callback && callback.call) callback.apply(this, args)
    }
  }
});

})();

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lsd_rails-0.1.6 Packages/mootools-ext/Source/Request/Request.Headers.js
lsd_rails-0.1.5 Packages/mootools-ext/Source/Request/Request.Headers.js
lsd_rails-0.1.4 Packages/mootools-ext/Source/Request/Request.Headers.js
lsd_rails-0.1.3 Packages/mootools-ext/Source/Request/Request.Headers.js
lsd_rails-0.1.2 Packages/mootools-ext/Source/Request/Request.Headers.js
lsd_rails-0.1.1 Packages/mootools-ext/Source/Request/Request.Headers.js
lsd_rails-0.1 Packages/mootools-ext/Source/Request/Request.Headers.js