Sha256: f6867d3adaf9c1a659d0ca8e170f147e97bbde37736890cf05d84e7b5020fed4

Contents?: true

Size: 1.08 KB

Versions: 20

Compression:

Stored size: 1.08 KB

Contents

(function() {

var Ap = Array.prototype;
var slice = Ap.slice;
var Fp = Function.prototype;

if (!Fp.bind) {
  // PhantomJS doesn't support Function.prototype.bind natively, so
  // polyfill it whenever this module is required.
  Fp.bind = function(context) {
    var func = this;
    var args = slice.call(arguments, 1);

    function bound() {
      var invokedAsConstructor = func.prototype && (this instanceof func);
      return func.apply(
        // Ignore the context parameter when invoking the bound function
        // as a constructor. Note that this includes not only constructor
        // invocations using the new keyword but also calls to base class
        // constructors such as BaseClass.call(this, ...) or super(...).
        !invokedAsConstructor && context || this,
        args.concat(slice.call(arguments))
      );
    }

    // The bound function must share the .prototype of the unbound
    // function so that any object created by one constructor will count
    // as an instance of both constructors.
    bound.prototype = func.prototype;

    return bound;
  };
}

})();

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
lurker-1.0.0 lib/lurker/templates/javascripts/phantomjs-shims.js
lurker-0.6.12 lib/lurker/templates/javascripts/phantomjs-shims.js
lurker-0.6.11 lib/lurker/templates/javascripts/phantomjs-shims.js
lurker-0.6.10 lib/lurker/templates/javascripts/phantomjs-shims.js
lurker-0.6.9 lib/lurker/templates/javascripts/phantomjs-shims.js
lurker-0.6.8 lib/lurker/templates/javascripts/phantomjs-shims.js
lurker-0.6.7 lib/lurker/templates/javascripts/phantomjs-shims.js
lurker-0.6.6 lib/lurker/templates/javascripts/phantomjs-shims.js
lurker-0.6.5 lib/lurker/templates/javascripts/phantomjs-shims.js
lurker-0.6.4 lib/lurker/templates/javascripts/phantomjs-shims.js
lurker-0.6.3 lib/lurker/templates/javascripts/phantomjs-shims.js
lurker-0.6.2 lib/lurker/templates/javascripts/phantomjs-shims.js
lurker-0.6.1 lib/lurker/templates/javascripts/phantomjs-shims.js
lurker-0.5.7 lib/lurker/templates/javascripts/phantomjs-shims.js
lurker-0.6.0 lib/lurker/templates/javascripts/phantomjs-shims.js
lurker-0.5.6 lib/lurker/templates/javascripts/phantomjs-shims.js
lurker-0.5.5 lib/lurker/templates/javascripts/phantomjs-shims.js
lurker-0.5.4 lib/lurker/templates/javascripts/phantomjs-shims.js
lurker-0.5.3 lib/lurker/templates/javascripts/phantomjs-shims.js
lurker-0.5.2 lib/lurker/templates/javascripts/phantomjs-shims.js