Created
August 14, 2011 17:42
-
-
Save felipeelias/1145110 to your computer and use it in GitHub Desktop.
sync
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
function Dog() { | |
this.url = '/dogs'; | |
this.fetch = function(callback) { | |
var self = this; | |
$.getJSON(this.url, function(attributes) { | |
self.attributes = attributes; | |
callback(attributes); | |
}); | |
} | |
} | |
function View() { | |
this.update = function(attributes) { | |
console.log(attributes.id, attributes.whatever); | |
} | |
} | |
var dog = new Dog(); | |
dog.fetch(function(attributes) { | |
var view = new View(); | |
view.update(attributes); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment