Is it possible to do this:
var hammer = new Hammer(); // create a new instance
hammer(nail); // really call Hammer.prototoype.hit(object);
I can figure it out on a raw object, but not when creating a new instance of an object. This is what I am running into:
function Hammer(options) {
this.config = options.blah;
this.hit(/* ? */);
return this;
}
Hammer.prototype.hit = function(obj) {
// ...
}
When I call the constructor, I want to pass in special options - not what nail to hit. However, when I call it later, I want to pass in a nail. I'm missing something.
function Hammer(object) { this.hit(object); }?hammer.hit(object);then?hit. That's the point of this question. If there isn't, well that's why I asked if its possible. :)