Skip to content

Instantly share code, notes, and snippets.

@mkempe mkempe/
Last active Aug 29, 2015

What would you like to do?
Coffeescript template for jQuery Plugin + Class.
class @Awesome
isItAwesome: true
constructor: (element, options) ->
@element = $ element
@options = $.extend { }, @defaults, options @
setup = ->
console.log "It's awesome..." if @options.isItAwesome?
(($, window, document) ->
$.fn.extend awesome: (options, args...) ->
@each ->
element = $ @
data = 'awesome'
if data
data[options].apply data, args if data[options]
else 'awesome', (data = new Awesome @, options)
) jQuery, window, document

This comment has been minimized.

Copy link
Owner Author

mkempe commented Feb 11, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.