All files / lib/core/runtime/navigation index.js

100% Statements 21/21
100% Branches 9/9
100% Functions 1/1
100% Lines 21/21

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2247x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 88x 2x 2x 88x 15x 15x 71x 88x  
import { BrowserNavigationDelegate } from './BrowserNavigationDelegate.js';
import { MemoryNavigationDelegate } from './MemoryNavigationDelegate.js';
 
export { NavigationDelegate } from './NavigationDelegate.js';
export { BrowserNavigationDelegate } from './BrowserNavigationDelegate.js';
export { MemoryNavigationDelegate } from './MemoryNavigationDelegate.js';
 
/**
 * Creates an appropriate navigation delegate based on configuration options and environment.
 * @param {object} [options]
 * @returns {object}
 */
export function createNavigationDelegate(options = {}) {
  if (options.delegate) {
    return options.delegate;
  }
  if (options.mode === 'memory' || typeof window === 'undefined') {
    return new MemoryNavigationDelegate(options.initialHash || '#/');
  }
  return new BrowserNavigationDelegate();
}