Module

Routing.Hash

Package
purescript-routing
Repository
slamdata/purescript-routing

#getHash Source

getHash :: forall eff. Eff (dom :: DOM | eff) String

Gets the global location hash.

#setHash Source

setHash :: forall eff. String -> Eff (dom :: DOM | eff) Unit

Sets the global location hash.

#modifyHash Source

modifyHash :: forall eff. (String -> String) -> Eff (dom :: DOM | eff) Unit

Modifies the global location hash.

#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)

#matchWith Source

matchWith :: forall a. (String -> String) -> Match a -> String -> Either String a

Runs a Match parser given a custom String decoder.

#match Source

match :: forall a. Match a -> String -> Either String a

Runs a Match parser.