Skip to content

Instantly share code, notes, and snippets.

@bttmly
Last active August 29, 2015 14:03
Show Gist options
  • Save bttmly/549a2ea8a363484caf2f to your computer and use it in GitHub Desktop.
Save bttmly/549a2ea8a363484caf2f to your computer and use it in GitHub Desktop.
extending the jQuery class
class JQueryInheritor extends jQuery
constructor: ( arg ) ->
jQuery.fn.init.call( this, arg );
myMethod = ->
# do something
function JQueryInheritor( arg ) {
jQuery.fn.init.call( this, arg );
}
JQueryInheritor.prototype = Object.create( jQuery.prototype );
JQueryInheritor.prototype.myMethod = function(){
// do something
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment