Module

Routing.Hash

#getHash

getHash :: Effect String

Gets the global location hash.

#setHash

setHash :: String -> Effect Unit

Sets the global location hash.

#modifyHash

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

Modifies the global location hash.

#foldHashes

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

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

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

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

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

Runs a Match parser given a custom String decoder.

#match

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

Runs a Match parser.

Modules