Skip to content

Instantly share code, notes, and snippets.

@cmer
Created December 26, 2011 05:31
Show Gist options
  • Save cmer/1520576 to your computer and use it in GitHub Desktop.
Save cmer/1520576 to your computer and use it in GitHub Desktop.
class Feed
fetch: ->
url = "http://example.org/feed?x=1"
url += "&ts=#{@oldest_item}" if @oldest_item
$.getJSON url, (data) ->
@oldest_item = data.oldest_item
# do something else with data
# How can I set a class variable from an anonymous function? For example, @oldest_item on line 4 is always null.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment