public
Created

javascript mixins with apply

  • Download Gist
1-stuff.js
JavaScript
1 2 3 4 5 6 7
function Stuff() {
this.whatever = function(){
$("#results").text("whatever was called");
}
 
// ... other stuff here
}
2-apply.js
JavaScript
1 2
foo = {};
Stuff.apply(foo);
3-whatever.js
JavaScript
1
foo.whatever(); // #=> "whatever was called"

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.