Skip to content

Instantly share code, notes, and snippets.

@fivetanley
Created September 27, 2012 16:59
Show Gist options
  • Save fivetanley/3795115 to your computer and use it in GitHub Desktop.
Save fivetanley/3795115 to your computer and use it in GitHub Desktop.
framework maybe?
define( function( require ) {
var framework = require( 'framework' )
, prototype
prototype = {
// self is always passed as the last argument to make functions re-usable
// and remove confusing `this` semantics
constructor: function( options, self ) {
self.model = options.model
}
, eventHandler: function( eventData, self ) {
self.model.changeState()
}
}
// if this is a viewmodel, we could do some magic to get jQuery
// methods like $.hide(), so new instances would have their own
// useful methods, for free.
return framework.wrap( prototype )
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment