Module

Routing.Hash

Package
purescript-routing
Repository
slamdata/purescript-routing

#getHash Source

getHash :: Effect String

Gets the global location hash.

#setHash Source

setHash :: String -> Effect Unit

Sets the global location hash.

#modifyHash Source

modifyHash :: (String -> String) -> Effect Unit

Modifies the global location hash.

#foldHashes Source

foldHashes :: forall a. (a -> String -> Effect a) -> (String -> Effect a) -> Effect (Effect 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 :: (Maybe String -> String -> Effect Unit) -> Effect (Effect 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. Match a -> (Maybe a -> a -> Effect Unit) -> Effect (Effect 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 f a. Foldable f => (String -> f a) -> (Maybe a -> a -> Effect Unit) -> Effect (Effect 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

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