Skip to content

Instantly share code, notes, and snippets.

@Killavus
Created July 17, 2014 12:48
Show Gist options
  • Save Killavus/22cfcf961e21edf27141 to your computer and use it in GitHub Desktop.
Save Killavus/22cfcf961e21edf27141 to your computer and use it in GitHub Desktop.
Simple backend class example.
class Backend
getData: ->
request = $.ajax
type: "GET"
dataType: "JSON"
url: '/foo'
request.pipe (response) ->
DomainObject.fromJSON(response)
# And then in initializer code:
@backend.getData()
.done (domainObject) =>
# Do something. For example: set state of the component you've rendered before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment