Skip to content

Commit

Permalink
Merge pull request #276 from FPtje/feat-fix-uri
Browse files Browse the repository at this point in the history
Added more info to URI returned by getCurrentURI
  • Loading branch information
dmjio authored Aug 29, 2017
2 parents e4af537 + 0157539 commit 3545d44
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ghcjs-src/Miso/Subscription/History.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ getCurrentURI = getURI
getURI :: IO URI
{-# INLINE getURI #-}
getURI = do
URI <$> pure mempty
URI <$> do unpack <$> getProtocol
<*> pure Nothing
<*> do Prelude.drop 1 . unpack <$> getPathName
<*> do unpack <$> getSearch
<*> pure mempty
<*> do unpack <$> getHash

-- | Pushes a new URI onto the History stack
pushURI :: URI -> IO ()
Expand Down Expand Up @@ -107,6 +107,12 @@ foreign import javascript unsafe "$r = window.location.pathname;"
foreign import javascript unsafe "$r = window.location.search;"
getSearch :: IO JSString

foreign import javascript unsafe "$r = window.location.hash;"
getHash :: IO JSString

foreign import javascript unsafe "$r = window.location.protocol;"
getProtocol :: IO JSString

foreign import javascript unsafe "window.addEventListener('popstate', $1);"
onPopState :: Callback (IO ()) -> IO ()

Expand Down

0 comments on commit 3545d44

Please sign in to comment.