Sha256: 6a9da4f42b03f435dac92db5bd908511361e0750129ebd16156f283b9e1a4dd6

Contents?: true

Size: 743 Bytes

Versions: 8

Compression:

Stored size: 743 Bytes

Contents

if (!Function.prototype.bind) {
  Function.prototype.bind = function(oThis) {
    if (typeof this !== 'function') {
      // closest thing possible to the ECMAScript 5
      // internal IsCallable function
      throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
    }

    var aArgs   = Array.prototype.slice.call(arguments, 1),
        fToBind = this,
        fNOP    = function() {},
        fBound  = function() {
          return fToBind.apply(this instanceof fNOP
                 ? this
                 : oThis,
                 aArgs.concat(Array.prototype.slice.call(arguments)));
        };

    fNOP.prototype = this.prototype;
    fBound.prototype = new fNOP();

    return fBound;
  };
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
storytime-2.1.6 vendor/assets/javascripts/phantom_js_bind_polyfill.js
storytime-2.1.5 vendor/assets/javascripts/phantom_js_bind_polyfill.js
storytime-2.1.4 vendor/assets/javascripts/phantom_js_bind_polyfill.js
storytime-2.1.3 vendor/assets/javascripts/phantom_js_bind_polyfill.js
storytime-2.1.2 vendor/assets/javascripts/phantom_js_bind_polyfill.js
storytime-2.1.1 vendor/assets/javascripts/phantom_js_bind_polyfill.js
storytime-2.1.0 vendor/assets/javascripts/phantom_js_bind_polyfill.js
storytime-2.0.0 vendor/assets/javascripts/phantom_js_bind_polyfill.js