Created
July 17, 2014 12:48
-
-
Save Killavus/22cfcf961e21edf27141 to your computer and use it in GitHub Desktop.
Simple backend class example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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