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

90.24% Statements 74/82
100% Branches 1/1
0% Functions 0/12
90.24% Lines 74/82

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 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 8347x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x     47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x     47x 47x 47x 47x 47x 47x     47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x     47x 47x 47x 47x 47x 47x  
/**
 * Base abstract class defining the navigation delegate interface.
 * Encapsulates environment-specific URL location management, event listening,
 * and page title operations.
 */
export class NavigationDelegate {
  /**
   * Gets the current location hash string (e.g. '#/home').
   * @returns {string}
   */
  getHash() {
    return '#/';
  }
 
  /* eslint-disable no-unused-vars */
  /**
   * Navigates/sets the current location hash string.
   * @param {string} hash - The target hash.
   * @param {object} [options] - Navigation options such as replace.
   */
  setHash(hash, options = {}) {}
 
  /**
   * Navigates backward in history.
   */
  back() {}
 
  /**
   * Navigates forward in history.
   */
  forward() {}
 
  /**
   * Navigates to a specific history position relative to current position.
   * @param {number} delta - Relative step count in history (e.g. -1 for back, 1 for forward).
   */
  go(delta) {}
  /* eslint-enable no-unused-vars */
  /**
   * Subscribes to location/hash change events.
   * @returns {Function} Unsubscribe function.
   */
  onHashChange() {
    return () => {};
  }
 
  /**
   * Subscribes to click events on links (e.g. [data-ax-link]).
   * @returns {Function} Unsubscribe function.
   */
  onLinkClick() {
    return () => {};
  }
 
  /**
   * Sets the document or in-memory title.
   */
  setTitle() {}
 
  /**
   * Registers a router instance for active router tracking.
   */
  registerRouter() {}
 
  /**
   * Unregisters a router instance.
   */
  unregisterRouter() {}
 
  /**
   * Returns all active router instances.
   * @returns {Set<object>}
   */
  getActiveRouters() {
    return new Set();
  }
 
  /**
   * Destroys the delegate and cleans up event listeners.
   */
  destroy() {}
}