Load View using Custom Method

In order to facilitate programming in the large it is useful to be able to extract views as separate components. These views should not be forced to be stored as HTML fragments or be loaded with jQuery.
Thus a way to inject custom views should be possible. This is done using the source- or sourceOnShow-properties. Just supply a method instead of a string!
These properties take a method that should take a pager.Page as first argument, a callback, and return nothing.

Load custom view using requireView-method
<div data-bind="page: {id: 'zoidberg', sourceOnShow: requireView('zoidberg')}"/>        
    
where
window.requireView = function(viewModule) {
    return function(page, callback) {
        require([viewModule], function(viewString) {
            $(page.element).html(viewString);
            callback();
        });
    };
};