js/router.js
/**
   * Update the DOM under outlet based on the active
   * selected route.
   */
Update the DOM under outlet based on the active
selected route.
Update the DOM under outlet based on the active selected route .
update() {
    const {
      component,
      title,
      params = {},
      resourceUrl = null
    } = this.activeRoute;
    if (component) {
      while (this.outlet.firstChild) {
        this.outlet.removeChild(this.outlet.firstChild);
      }
      const updateView = () => {
        const view = document.createElement(component);
        document.title = title || document.title;
        for (let key in params) {
          if (key !== "*") view.setAttribute(key, params[key]);
        }
        this.outlet.appendChild(view);
        this.updateLinks();
      };
      if (resourceUrl !== null) {
        import(resourceUrl).then(updateView);
      } else {
        updateView();
      }
    }
  }
update ( ) { const { component , title , params = { } , resourceUrl = null } = this . activeRoute ; if ( component ) { while ( this . outlet . firstChild ) { this . outlet . removeChild ( this . outlet . firstChild ) ; } const updateView = ( ) => { const view = document . createElement ( component ) ; document . title = title || document . title ; for ( let key in params ) { if ( key !== "*" ) view . setAttribute ( key , params [ key ] ) ; } this . outlet . appendChild ( view ) ; this . updateLinks ( ) ; } ; if ( resourceUrl !== null ) { import ( resourceUrl ) . then ( updateView ) ; } else { updateView ( ) ; } } }
Update the DOM under outlet based on the active
 selected route.
Update the DOM under outlet based on the active selected route .
// Remove all child nodes under outlet element /**
           * all dynamic param value will be passed
           * as the attribute to the newly created element
           * except * value.
           */ // Update the route links once the DOM is updated