javascript - MooTools class binding with CoffeeScript -
how can write following in coffeescript?
showmessage: function() { $('myelement').addevent('click', function() { alert(this.options.message); }.bind(this)); },
i believe following should work:
someclass = new class showmessage: -> $('myelement').addevent 'click', => alert @options.message
coffescript bit weird, , outputs return
everywhere, can cause problems, of time doesn't.
Comments
Post a Comment