diff options
| author | Roman Smrž <roman.smrz@seznam.cz> | 2026-07-04 21:56:35 +0200 |
|---|---|---|
| committer | Roman Smrž <roman.smrz@seznam.cz> | 2026-07-22 21:15:38 +0200 |
| commit | 7811d5658c75344dd1787cd821c5c28e2a3dab32 (patch) | |
| tree | 6a4316e0761f35f19f1caa4958b7839155b7f9da /src/JavaScript.hs | |
| parent | 9686f788eab5690edad7a6b692aa2a926cddc8b8 (diff) | |
Attach service handling using URL parameter
Diffstat (limited to 'src/JavaScript.hs')
| -rw-r--r-- | src/JavaScript.hs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/JavaScript.hs b/src/JavaScript.hs index aaf3747..3039b3f 100644 --- a/src/JavaScript.hs +++ b/src/JavaScript.hs @@ -8,6 +8,9 @@ module JavaScript ( consoleLogVal, historyPushState, + locationAssign, + locationGetHash, + locationSetHash, ) where import JavaScript.Element @@ -29,3 +32,18 @@ historyPushState :: String -> IO () historyPushState = js_history_pushState . toJSString foreign import javascript unsafe "history.pushState(null, '', $1)" js_history_pushState :: JSString -> IO () + +locationAssign :: String -> IO () +locationAssign = js_location_assign . toJSString +foreign import javascript unsafe "window.location.assign($1)" + js_location_assign :: JSString -> IO () + +locationGetHash :: IO String +locationGetHash = fromJSString <$> js_location_hash_get +foreign import javascript unsafe "window.location.hash" + js_location_hash_get :: IO JSString + +locationSetHash :: String -> IO () +locationSetHash = js_location_hash_set . toJSString +foreign import javascript unsafe "window.location.hash = $1" + js_location_hash_set :: JSString -> IO () |