Created
November 24, 2012 22:41
-
-
Save gergob/4141700 to your computer and use it in GitHub Desktop.
buildAnimal function
This file contains 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
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