Skip to content

Instantly share code, notes, and snippets.

@dmethvin
Last active August 29, 2015 14:03
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 dmethvin/2836ae6e52e85c5ae083 to your computer and use it in GitHub Desktop.
Save dmethvin/2836ae6e52e85c5ae083 to your computer and use it in GitHub Desktop.
function SomeWidget( $elem ) {
this.$elem = $elem;
}
SomeWidget.prototype = {
constructor: SomeWidget,
renderTo: function( target ) {
$( target ).append( this.$elem.on( "click mousemove", this ) );
},
mousemove: function( e ) {
},
click: function( e ) {
},
handleEvent: function( e ) {
return this[ e.type ].apply( this, arguments );
}
};
var widget = new SomeWidget();
$(elems).onMulti("click mouseover", widget);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment