@@ -11,18 +11,18 @@ module Routing.Hash
1111
1212import Prelude
1313
14+ import Data.Foldable (class Foldable , indexl )
15+ import Data.Maybe (Maybe (..), fromMaybe , maybe )
16+ import Data.String (Pattern (..), stripPrefix )
1417import Effect (Effect )
1518import Effect.Ref as Ref
19+ import Routing (match , matchWith )
20+ import Routing.Match (Match )
1621import Web.Event.EventTarget (addEventListener , eventListener , removeEventListener )
1722import Web.HTML (window )
23+ import Web.HTML.Event.HashChangeEvent.EventTypes as ET
1824import Web.HTML.Location as L
1925import Web.HTML.Window as Window
20- import Web.HTML.Window.EventTypes as WET
21- import Data.Foldable (class Foldable , indexl )
22- import Data.Maybe (Maybe (..), fromMaybe , maybe )
23- import Data.String (Pattern (..), stripPrefix )
24- import Routing (match , matchWith )
25- import Routing.Match (Match )
2626
2727-- | Gets the global location hash.
2828getHash :: Effect String
@@ -48,8 +48,8 @@ foldHashes cb init = do
4848 ref <- Ref .new =<< init =<< getHash
4949 win <- Window .toEventTarget <$> window
5050 listener <- eventListener \_ -> flip Ref .write ref =<< join (cb <$> Ref .read ref <*> getHash)
51- addEventListener WET .hashchange listener false win
52- pure $ removeEventListener WET .hashchange listener false win
51+ addEventListener ET .hashchange listener false win
52+ pure $ removeEventListener ET .hashchange listener false win
5353
5454-- | Runs the callback on every hash change providing the previous hash and the
5555-- | latest hash. The provided String is the hash portion of the `Location` with
0 commit comments