src/clientVueLoader.js
// Creates a load function that will be called whenever Vue needs the component.
Creates a load function that will be called whenever Vue needs the component.
Creates a load function that will be called whenever Vue needs the component .
static createLoadFunction(url, name) {
            return async function () {
                try {
                    let component = cache[url]; 
                    if (!component) {
                        component = new Component(name, url);
                        await component.load();
                        await component.normalize();
                        await component.compile();
                        const exports = component.exports = component.script !== null ? component.script.result : {};
                        if (component.template !== null) {
                            if (exports.template) {
                                throw new Error(
                                    "There is already a template function or string in module.exports that collides with the template tag (<template>) defined in the vue component.");
                            }
                            exports.template = component.template.content;
                        }
                        if (exports.name === undefined) {
                            exports.name = component.name;
                        }
                        exports.mixins = [{
                            data: function () {
                                const result = {
                                    _baseUrl: component.url,
                                    _component: component
                                };
                                for (let style in component.moduleStyles) {
                                    result[style] = component.moduleStyles[style];
                                }
                                return result;
                            }
                        }];
                        cache[url] = component;
                    }
                    return component.exports;
                } catch (ex) {
                    console.error(ex);
                    throw ex;
                }
            };
        }
static createLoadFunction ( url , name ) { return async function ( ) { try { let component = cache [ url ] ; if ( ! component ) { component = new Component ( name , url ) ; await component . load ( ) ; await component . normalize ( ) ; await component . compile ( ) ; const exports = component . exports = component . script !== null ? component . script . result : { } ; if ( component . template !== null ) { if ( exports . template ) { throw new Error ( "There is already a template function or string in module.exports that collides with the template tag (<template>) defined in the vue component." ) ; } exports . template = component . template . content ; } if ( exports . name === undefined ) { exports . name = component . name ; } exports . mixins = [ { data : function ( ) { const result = { _baseUrl : component . url , _component : component } ; for ( let style in component . moduleStyles ) { result [ style ] = component . moduleStyles [ style ] ; } return result ; } } ] ; cache [ url ] = component ; } return component . exports ; } catch ( ex ) { console . error ( ex ) ; throw ex ; } } ; }
Creates a load function that will be called whenever Vue needs the component.
Creates a load function that will be called whenever Vue needs the component .
// Check the cache. // Set the templates. // Set the name of the component. // Cache the result.