Using knockout.js components I'm wondering if performance get affected when passing multiple viewmodels to a component instead of just a single one.
Having the following:
function masterViewModel(){
this.demo = new demoViewModel().init();
this.demo2 = new demo2ViewModel().init();
this.demo3 = new demo3ViewModel().init();
this.demo4 = new demo4ViewModel().init();
this.demo5 = new demo5ViewModel().init();
this.demo6 = new demo6ViewModel().init();
}
var mm = new masterViewModel();
ko.applyBindings(mm, $(':root').get(0));
I was thinking of passing the whole masterViewModel variable to my component in order to be able to access all viewmodels from it:
ko.components.register(element, {
viewModel: { instance: mm },
template: { require: 'text!views/myComponent.html' },
});
Would performance get affected in a bad way if I do that instead of just passing a single viewmodel?
ko.components.register(element, {
viewModel: { instance: mm.demo3 },
template: { require: 'text!views/myComponent.html' },
});