diff options
| author | Roman Smrž <roman.smrz@seznam.cz> | 2026-03-17 21:12:21 +0100 |
|---|---|---|
| committer | Roman Smrž <roman.smrz@seznam.cz> | 2026-03-17 21:12:21 +0100 |
| commit | 72d735ff9ae7f34e15c68ddd6824d651e87b7983 (patch) | |
| tree | c40df8a710ce05c073506a7c41e00e01a9cd4207 /src/JavaScript.hs | |
| parent | fd1486ce5353749fb595ce62a615c01764d38bc6 (diff) | |
Return Maybe from getElementById
Diffstat (limited to 'src/JavaScript.hs')
| -rw-r--r-- | src/JavaScript.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/JavaScript.hs b/src/JavaScript.hs index bc27818..81b3502 100644 --- a/src/JavaScript.hs +++ b/src/JavaScript.hs @@ -12,8 +12,8 @@ module JavaScript ( import GHC.Wasm.Prim -getElementById :: String -> IO JSVal -getElementById = js_document_getElementById . toJSString +getElementById :: String -> IO (Maybe JSVal) +getElementById = fmap nullToNothing . js_document_getElementById . toJSString foreign import javascript unsafe "document.getElementById($1)" js_document_getElementById :: JSString -> IO JSVal |