Skip to content

Instantly share code, notes, and snippets.

@vessi
Created August 4, 2012 22:29
Show Gist options
  • Save vessi/3260357 to your computer and use it in GitHub Desktop.
Save vessi/3260357 to your computer and use it in GitHub Desktop.
coffeescript simple widget
window.Widget =
init: ->
$('*[data-widget]:not(*[data-widget-initialized])').each (_, container) ->
element = $(container)
element.attr('data-widget-initialized', 'true')
klass = window[element.data('widget')]
new klass(element)
$ ->
Widget.init()
@vessi
Copy link
Author

vessi commented Aug 5, 2012 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment