defineRequest() {
    let arg1 = arguments[0];
    let arg2 = arguments[1];
    let arg3 = arguments[2];
    let fromPath = '/*';
    let toPath = '/*';
    let handler = null;

    switch (arguments.length) {
      case 1:
        if (typeof arg1 !== 'function') throw new Error(`Second argument to defineRequest() must be a function`);
        handler = arg1;
        break;
      case 2:
        if (typeof arg1 === 'string' && typeof arg2 === 'string') {
          fromPath = arg1;
          toPath = arg2;
        }
        else if (typeof arg1 === 'string' && typeof arg2 === 'function') {
          toPath = arg1;
          handler = arg2;
        }
        else {
          throw new Error(`Expecting first argument to be a path and second argument to be either a path/function`);
        }
        break;
      case 3:
        if (typeof arg1 !== 'string') throw new Error(`First argument to defineRequest() must be a path`);
        if (typeof arg2 !== 'string') throw new Error(`Second argument to defineRequest() must be a path`);
        if (typeof arg3 !== 'function') throw new Error(`Third argument to defineRequest() must be a function`);
        fromPath = arg1;
        toPath = arg2;
        handler = arg3;
        break;
      default:
        throw new Error(`Invalid arguments passed to defineRequest(), expecting at least 1 and maximum 3 arguments`);
    }

    toPath = PageManager.normalizePath(toPath, true);
    fromPath = PageManager.normalizePath(fromPath, true);

    if (!this.requests[toPath]) this.requests[toPath] = {};
    this.requests[toPath][fromPath] = handler;
  }
/**
   * Defines a request handler.
   *
   * @param {string|Function} - The meaning of this value depends on the number
   *                            of arguments passed into this method.
   *                            1: This will be the handler for all page
   *                               requests made.
   *                            2: This will be the to path.
   *                            3: This will be the from path.
   * @param {string|Function} - The meaning of this value depends on the number
   *                            of arguments passed into this method.
   *                            2: This will be the handler for all page
   *                               requests made.
   *                            3: This will be the to path.
   * @param {function} - The handler for requests made for the specific from/to
   *                     path combo.
   */
Defines a request handler.
@param {string|Function} - The meaning of this value depends on the number
of arguments passed into this method.
1: This will be the handler for all page
requests made.
2: This will be the to path.
3: This will be the from path.
@param {string|Function} - The meaning of this value depends on the number
of arguments passed into this method.
2: This will be the handler for all page
requests made.
3: This will be the to path.
@param {function} - The handler for requests made for the specific from/to
path combo.
Defines a request handler . @param { string|Function } - The meaning of this value depends on the number of arguments passed into this method . 1 : This will be the handler for all page requests made . 2 : This will be the to path . 3 : This will be the from path . @param { string|Function } - The meaning of this value depends on the number of arguments passed into this method . 2 : This will be the handler for all page requests made . 3 : This will be the to path . @param { function } - The handler for requests made for the specific from / to path combo .
defineRequest() {
    let arg1 = arguments[0];
    let arg2 = arguments[1];
    let arg3 = arguments[2];
    let fromPath = '/*';
    let toPath = '/*';
    let handler = null;
    switch (arguments.length) {
      case 1:
        if (typeof arg1 !== 'function') throw new Error(`Second argument to defineRequest() must be a function`);
        handler = arg1;
        break;
      case 2:
        if (typeof arg1 === 'string' && typeof arg2 === 'string') {
          fromPath = arg1;
          toPath = arg2;
        }
        else if (typeof arg1 === 'string' && typeof arg2 === 'function') {
          toPath = arg1;
          handler = arg2;
        }
        else {
          throw new Error(`Expecting first argument to be a path and second argument to be either a path/function`);
        }
        break;
      case 3:
        if (typeof arg1 !== 'string') throw new Error(`First argument to defineRequest() must be a path`);
        if (typeof arg2 !== 'string') throw new Error(`Second argument to defineRequest() must be a path`);
        if (typeof arg3 !== 'function') throw new Error(`Third argument to defineRequest() must be a function`);
        fromPath = arg1;
        toPath = arg2;
        handler = arg3;
        break;
      default:
        throw new Error(`Invalid arguments passed to defineRequest(), expecting at least 1 and maximum 3 arguments`);
    }
    toPath = PageManager.normalizePath(toPath, true);
    fromPath = PageManager.normalizePath(fromPath, true);
    if (!this.requests[toPath]) this.requests[toPath] = {};
    this.requests[toPath][fromPath] = handler;
  }
defineRequest ( ) { let arg1 = arguments [ 0 ] ; let arg2 = arguments [ 1 ] ; let arg3 = arguments [ 2 ] ; let fromPath = '/*' ; let toPath = '/*' ; let handler = null ; switch ( arguments . length ) { case 1 : if ( typeof arg1 !== 'function' ) throw new Error ( ` ` ) ; handler = arg1 ; break ; case 2 : if ( typeof arg1 === 'string' && typeof arg2 === 'string' ) { fromPath = arg1 ; toPath = arg2 ; } else if ( typeof arg1 === 'string' && typeof arg2 === 'function' ) { toPath = arg1 ; handler = arg2 ; } else { throw new Error ( ` ` ) ; } break ; case 3 : if ( typeof arg1 !== 'string' ) throw new Error ( ` ` ) ; if ( typeof arg2 !== 'string' ) throw new Error ( ` ` ) ; if ( typeof arg3 !== 'function' ) throw new Error ( ` ` ) ; fromPath = arg1 ; toPath = arg2 ; handler = arg3 ; break ; default : throw new Error ( ` ` ) ; } toPath = PageManager . normalizePath ( toPath , true ) ; fromPath = PageManager . normalizePath ( fromPath , true ) ; if ( ! this . requests [ toPath ] ) this . requests [ toPath ] = { } ; this . requests [ toPath ] [ fromPath ] = handler ; }
Defines a request handler.
Defines a request handler .