miso
Copyright(C) 2016-2025 David M. Johnson
LicenseBSD3-style (see the file LICENSE)
MaintainerDavid M. Johnson <code@dmj.io>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Miso.FFI

Description

 
Synopsis

Functions

set :: ToJSVal v => MisoString -> v -> Object -> JSM () Source #

Set property on object

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.

reload :: JSM () Source #

Calls the location.reload() 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)

asyncCallback :: JSM () -> JSM Function Source #

Creates an asynchronous callback function

Image

newtype Image Source #

Constructors

Image JSVal 

Instances

Instances details
ToJSVal Image Source # 
Instance details

Defined in Miso.FFI.Internal

newImage :: MisoString -> JSM Image Source #

Smart constructor for building a Image w/ src attribute.

Audio

newtype Audio Source #

Constructors

Audio JSVal 

Instances

Instances details
ToJSVal Audio Source # 
Instance details

Defined in Miso.FFI.Internal

play :: Audio -> JSM () Source #