rally/runtime/browser_navigation

Rally-owned browser navigation policy.

Modem owns URL change messages and browser history listeners. Rally owns which links are eligible for SPA navigation before history is pushed.

Values

pub fn listen_browser_navigation(
  to_message: fn(String) -> msg,
) -> effect.Effect(msg)

Listen for browser-owned URL changes.

Same-origin link clicks are disabled here. Rally’s generated runtime installs a separate mount-aware link listener so app pages do not need to undo broad same-origin interception after it has already happened.

pub fn listen_shell_navigation(
  to_message: fn(String) -> msg,
) -> effect.Effect(msg)

Listen for normal same-mount document links.

Same-origin links in the current mount are SPA navigations by default. Links that switch mounts, such as public to admin, are left alone so the browser loads the correct entrypoint. Add data-rally-document-nav when an otherwise interceptable link should force a document navigation.

pub fn navigate(path: String) -> effect.Effect(msg)

Push a URL and notify browser navigation listeners.

pub fn push_path(path: String) -> effect.Effect(msg)

Push a URL after Rally has already handled the navigation.

This intentionally does not use modem.push, which emits a URL-change event. Generated Rally mounts have already loaded the target page by the time they call this function.

Search Document