Skip to content

Instantly share code, notes, and snippets.

@yurfuwa-chan
Created January 6, 2012 10:44
Show Gist options
  • Save yurfuwa-chan/1570067 to your computer and use it in GitHub Desktop.
Save yurfuwa-chan/1570067 to your computer and use it in GitHub Desktop.
coffeescript example
#jQuery module
jQuery ->
$.deferred.define();
#private variable
test = new Test
#call test public method;
$("#hoge p").click(=>test.test());
#class
class Test
#private member
_json = null
getData : -> _json
test: =>
next(=>
$.getJSON(
"static.json"
).
next((d) =>
_json = d
)
).
next(=>
console.log("complete")
console.log(@getData())
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment