Skip to content
scalive
Menu
ConnectingLiveReconnectingOffline
GitHub
o

navigation

object navigation

Defined by scalive.navigation. View source (scalive/api/src/scalive/Scalive.scala:175-191)

Methods1

guardWhen

def guardWhen(dirty: Signal[Boolean], message: String): Mod.Attr[Nothing]

Guards browser-initiated navigation while dirty is true.

Add the returned modifier to the element which owns the dirty state and install the NavigationGuardAssets script in the root layout. The browser runtime uses message for live links, live patch links, and LiveView history traversal. Browsers use their own generic message for cross-document history traversal, reload, and tab-close confirmation.

The guard reflects the latest value rendered by the server. Server-issued navigation and navigation encoded in a JSCommand bypass the configured confirmation, but a resulting document unload may still request the browser's generic confirmation.

Defined by scalive.navigation.guardWhen. View source (scalive/api/src/scalive/Scalive.scala:189-191)