examples/HTML StarterKit/lib/durandal/js/plugins/widget.js
function(config){
            config.bindingName = config.bindingName || 'widget';

            if(config.kinds){
                var toRegister = config.kinds;

                for(var i = 0; i < toRegister.length; i++){
                    widget.registerKind(toRegister[i]);
                }
            }

            ko.bindingHandlers[config.bindingName] = {
                init: function() {
                    return { controlsDescendantBindings: true };
                },
                update: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
                    var settings = widget.getSettings(valueAccessor);
                    extractParts(element, settings);
                    widget.create(element, settings, bindingContext, true);
                }
            };

            composition.composeBindings.push(config.bindingName + ':');
            ko.virtualElements.allowedBindings[config.bindingName] = true;
        }
function(config){
            config.bindingName = config.bindingName || 'widget';

            if(config.kinds){
                var toRegister = config.kinds;

                for(var i = 0; i < toRegister.length; i++){
                    widget.registerKind(toRegister[i]);
                }
            }

            ko.bindingHandlers[config.bindingName] = {
                init: function() {
                    return { controlsDescendantBindings: true };
                },
                update: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
                    var settings = widget.getSettings(valueAccessor);
                    extractParts(element, settings);
                    widget.create(element, settings, bindingContext, true);
                }
            };

            composition.composeBindings.push(config.bindingName + ':');
            ko.virtualElements.allowedBindings[config.bindingName] = true;
        }
function ( config ) { config . bindingName = config . bindingName || 'widget' ; if ( config . kinds ) { var toRegister = config . kinds ; for ( var i = 0 ; i < toRegister . length ; i ++ ) { widget . registerKind ( toRegister [ i ] ) ; } } ko . bindingHandlers [ config . bindingName ] = { init : function ( ) { return { controlsDescendantBindings : true } ; } , update : function ( element , valueAccessor , allBindingsAccessor , viewModel , bindingContext ) { var settings = widget . getSettings ( valueAccessor ) ; extractParts ( element , settings ) ; widget . create ( element , settings , bindingContext , true ) ; } } ; composition . composeBindings . push ( config . bindingName + ':' ) ; ko . virtualElements . allowedBindings [ config . bindingName ] = true ; }
Installs the widget module by adding the widget binding handler and optionally registering kinds.
@method install
@param {object} config The module config. Add a `kinds` array with the names of widgets to automatically register. You can also specify a `bindingName` if you wish to use another name for the widget binding, such as "control" for example.
Installs the widget module by adding the widget binding handler and optionally registering kinds .