Skip to content

Instantly share code, notes, and snippets.

@gergob
Created November 24, 2012 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gergob/4141700 to your computer and use it in GitHub Desktop.
Save gergob/4141700 to your computer and use it in GitHub Desktop.
buildAnimal function
buildAnimal: function (model) {
var newAnimal = new Zoo.Animal();
if (model.hasOwnProperty("name")) {
newAnimal.setName(model.name);
}
if (model.hasOwnProperty("age")) {
newAnimal.setAge(model.age);
}
if (model.hasOwnProperty("hoursSinceLastFeed")) {
newAnimal.setHoursSinceLastFeed(model.hoursSinceLastFeed);
}
//return a Bindable object
return new WinJS.Binding.as(newAnimal);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment