Skip to content

Instantly share code, notes, and snippets.

@davidlaym
Created January 24, 2013 14:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidlaym/4622303 to your computer and use it in GitHub Desktop.
Save davidlaym/4622303 to your computer and use it in GitHub Desktop.
a jquery ui 1.9 widget boilerplate code using coffeescript
do ($ = jQuery, window, document) ->
$.widget "namespace.widgetName",
options:
somevalue: null
someCallback: ->
_create: ->
#element creation, apply theming, bind events etc.
_destroy: ->
#cleanup DOM
_setOption: (key, value) ->
switch key
when "someValue"
# this.options.someValue = doSomethingWith( value );
else
# this.options[ key ] = value;
this._super( "_setOption", key, value );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment