Skip to content

Instantly share code, notes, and snippets.

@adjohu
Created February 22, 2013 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adjohu/5014049 to your computer and use it in GitHub Desktop.
Save adjohu/5014049 to your computer and use it in GitHub Desktop.
var createClass = function (methods, staticMethods) {
if (!methods || !methods.hasOwnProperty("init")) {
throw "you must include an init method";
}
var newClass = function () {
this.init();
};
$.extend(newClass.prototype, methods);
$.extend(newClass, staticMethods);
return newClass;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment