Client-side routing for multi-view apps. Pure data structure
maintaining a navigation stack of {path, params} entries.
The stack is last-in-first-out. push/3 adds a new entry on top;
pop/1 removes the top entry (never pops the last one). current/1
and params/1 read from the top of the stack.
Example
route = Plushie.Route.new(:home)
route = Plushie.Route.push(route, :settings, %{tab: "general"})
Plushie.Route.current(route)
#=> :settings
Plushie.Route.params(route)
#=> %{tab: "general"}
route = Plushie.Route.pop(route)
Plushie.Route.current(route)
#=> :home
Summary
Functions
Returns true if there is more than one entry on the stack.
Returns the current (top) path.
Returns a list of all paths in the stack, most recent first.
Creates a new route with initial_path at the bottom of the stack.
Returns the params associated with the current (top) path.
Pops the top entry from the stack. Returns the route unchanged if only one entry remains (the root is never popped).
Pushes a new path (with optional params) onto the navigation stack.
Replaces the top entry with a new path and params.
Types
Functions
Returns true if there is more than one entry on the stack.
Returns the current (top) path.
Returns a list of all paths in the stack, most recent first.
Creates a new route with initial_path at the bottom of the stack.
params defaults to an empty map.
Returns the params associated with the current (top) path.
Pops the top entry from the stack. Returns the route unchanged if only one entry remains (the root is never popped).
Pushes a new path (with optional params) onto the navigation stack.
Replaces the top entry with a new path and params.