Created
July 31, 2013 17:55
-
-
Save kristoferjoseph/6124411 to your computer and use it in GitHub Desktop.
Example View Factory
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
var viewMappings = { | |
}; | |
var addMapping = function (type, viewClass) { | |
viewMappings[type] = viewClass; | |
}; | |
var create = function (viewModel) { | |
var ViewClass = viewMappings[viewModel.get("type")]; | |
if (ViewClass) { | |
return new ViewClass({model: viewModel}); | |
} | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment