Skip to content

Instantly share code, notes, and snippets.

@jed
Created August 20, 2011 08:34
Show Gist options
  • Save jed/1158857 to your computer and use it in GitHub Desktop.
Save jed/1158857 to your computer and use it in GitHub Desktop.
a cleaner prototype setup for coffeescript
var Widget;
Widget = new function() {
function Widget() {}
Widget.prototype = this;
this.foo = function() {};
this.bar = function() {};
this.baz = function() {};
return Widget;
};
var Widget;
Widget = (function() {
function Widget() {}
Widget.prototype.foo = function() {};
Widget.prototype.bar = function() {};
Widget.prototype.baz = function() {};
return Widget;
})();
class Widget
foo: ->
bar: ->
baz: ->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment