Copyright | (C) 2016-2025 David M. Johnson |
---|---|
License | BSD3-style (see the file LICENSE) |
Maintainer | David M. Johnson <code@dmj.io> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Miso.FFI
Description
Synopsis
- set :: ToJSVal v => MisoString -> v -> Object -> JSM ()
- now :: JSM Double
- consoleLog :: MisoString -> JSM ()
- consoleLog' :: JSVal -> JSM ()
- consoleError :: MisoString -> JSM ()
- consoleWarn :: MisoString -> JSM ()
- getElementById :: MisoString -> JSM JSVal
- focus :: MisoString -> JSM ()
- blur :: MisoString -> JSM ()
- alert :: MisoString -> JSM ()
- reload :: JSM ()
- addStyle :: MisoString -> JSM ()
- addStyleSheet :: MisoString -> JSM ()
- syncCallback :: JSM () -> JSM Function
- syncCallback1 :: (JSVal -> JSM ()) -> JSM Function
- asyncCallback :: JSM () -> JSM Function
- newtype Image = Image JSVal
- newImage :: MisoString -> JSM Image
- newtype Audio = Audio JSVal
- newAudio :: MisoString -> JSM Audio
- play :: Audio -> JSM ()
- volume :: Audio -> Double -> JSM ()
- pause :: Audio -> JSM ()
- paused :: Audio -> JSM Bool
Functions
Retrieve high resolution time stamp
See https://developer.mozilla.org/en-US/docs/Web/API/Performance/now
consoleLog :: MisoString -> JSM () Source #
Outputs a message to the web console
See https://developer.mozilla.org/en-US/docs/Web/API/Console/log
Console logging of JavaScript strings.
consoleLog' :: JSVal -> JSM () Source #
Console-logging of JSVal
consoleError :: MisoString -> JSM () Source #
Outputs an error message to the web console
See https://developer.mozilla.org/en-US/docs/Web/API/Console/error
Console logging of JavaScript strings.
consoleWarn :: MisoString -> JSM () Source #
Outputs a warning message to the web console
See https://developer.mozilla.org/en-US/docs/Web/API/Console/warn
Console logging of JavaScript strings.
getElementById :: MisoString -> JSM JSVal Source #
Returns an Element object representing the element whose id property matches the specified string.
See https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById
focus :: MisoString -> JSM () Source #
Fails silently if the element is not found.
Analogous to document.getElementById(id).focus()
.
blur :: MisoString -> JSM () Source #
Fails silently if the element is not found.
Analogous to document.getElementById(id).blur()
alert :: MisoString -> JSM () Source #
Calls the alert()
function.
addStyle :: MisoString -> JSM () Source #
Appends a style_
element containing CSS to head_
addStyle "body { background-color: green; }"
<head><style>body { background-color: green; }</style></head>
addStyleSheet :: MisoString -> JSM () Source #
Appends a StyleSheet link_
element to head_
The link_
tag will contain a URL to a CSS file.
addStyleSheet "https://cdn.jsdelivr.net/npm/todomvc-common@1.0.5/base.min.css"
<head><link href="https://cdn.jsdelivr.net/npm/todomvc-common@1.0.5/base.min.css" ref="stylesheet"></head>
syncCallback :: JSM () -> JSM Function Source #
Creates a synchronous callback function (no return value)
Image
newImage :: MisoString -> JSM Image Source #
Smart constructor for building a Image
w/ src
attribute.