I am using requireJS in my sample demo app. This is my code:
require({
paths: {
ToDoModel: '/Scripts/ToDoModel.min',
ToDo: '/Scripts/ToDo.min',
ToDoService: '/Scripts/ToDoService.min'
}
}, ['ToDo'], function (ToDo) {
ko.applyBindings(new ToDo(), $('#toDo')[0]);
}
);
I know I need some of the files as soon the app loads. Thus I want to combine ToDoModel, ToDo and ToDoService all into one file and yet define
them as separate like this:
define('ToDoModel', [], function () {
ToDoModel = function (data) {
ko.mapping.fromJS(data, {}, this);
}
return ToDoModel;
});
All the moment all are in separate files as you can see in the paths attribute.