Routing.Hash
- Package
- purescript-routing
- Repository
- slamdata/purescript-routing
#foldHashes Source
foldHashes :: forall a eff. (a -> String -> Eff (RoutingEffects eff) a) -> (String -> Eff (RoutingEffects eff) a) -> Eff (RoutingEffects eff) (Eff (RoutingEffects eff) Unit)
Folds effectfully over hash changes given a callback and an initial hash.
The provided String is the hash portion of the Location
with the '#'
prefix stripped. Returns an effect which will remove the listener.
#hashes Source
hashes :: forall eff. (Maybe String -> String -> Eff (RoutingEffects eff) Unit) -> Eff (RoutingEffects eff) (Eff (RoutingEffects eff) Unit)
Runs the callback on every hash change providing the previous hash and the
latest hash. The provided String is the hash portion of the Location
with
the '#' prefix stripped. Returns an effect which will remove the listener.
#matches Source
matches :: forall a eff. Match a -> (Maybe a -> a -> Eff (RoutingEffects eff) Unit) -> Eff (RoutingEffects eff) (Eff (RoutingEffects eff) Unit)
Runs the callback on every hash change using a given Match
parser to
extract a route from the hash. If a hash fails to parse, it is ignored.
To avoid dropping hashes, provide a fallback alternative in your parser.
Returns an effect which will remove the listener.
#matchesWith Source
matchesWith :: forall a f eff. Foldable f => (String -> f a) -> (Maybe a -> a -> Eff (RoutingEffects eff) Unit) -> Eff (RoutingEffects eff) (Eff (RoutingEffects eff) Unit)
Runs the callback on every hash change using a given custom parser to extract a route from the hash. If a hash fails to parse, it is ignored. To avoid dropping hashes, provide a fallback alternative in your parser. Returns an effect which will remove the listener.
Re-exports from Routing
#RoutingEffects Source
type RoutingEffects eff = (dom :: DOM, ref :: REF | eff)