Sha256: c89d2f5f622318bb7bd38eb36472131e70bdb95e45431cd9397a192fa3fd24f7

Contents?: true

Size: 732 Bytes

Versions: 17

Compression:

Stored size: 732 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 && oThis
              ? this
              : oThis,
              aArgs.concat(Array.prototype.slice.call(arguments)));
        };

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

    return fBound;
  };
}

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
teaspoon-1.4.0 app/assets/javascripts/support/bind-poly.js
teaspoon-1.2.2 app/assets/javascripts/support/bind-poly.js
teaspoon-1.2.1 app/assets/javascripts/support/bind-poly.js
teaspoon-1.2.0 app/assets/javascripts/support/bind-poly.js
teaspoon-1.1.5 app/assets/javascripts/support/bind-poly.js
teaspoon-1.1.4 app/assets/javascripts/support/bind-poly.js
teaspoon-1.1.3 app/assets/javascripts/support/bind-poly.js
teaspoon-1.1.2 app/assets/javascripts/support/bind-poly.js
teaspoon-1.1.1 app/assets/javascripts/support/bind-poly.js
teaspoon-1.1.0 app/assets/javascripts/support/bind-poly.js
teaspoon-1.0.2 app/assets/javascripts/support/bind-poly.js
teaspoon-1.0.1 app/assets/javascripts/support/bind-poly.js
teaspoon-1.0.0 app/assets/javascripts/support/bind-poly.js
teaspoon-0.9.1 vendor/assets/javascripts/support/bind-poly.js
teaspoon-0.9.0 vendor/assets/javascripts/support/bind-poly.js
teaspoon-0.8.0 vendor/assets/javascripts/support/bind-poly.js
teaspoon-0.7.9 vendor/assets/javascripts/support/bind-poly.js