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

Miso.Native.FFI

Description

 
Synopsis

Lynx specific FFI

invokeExec Source #

Arguments

:: (ToJSVal params, FromJSVal argument) 
=> MisoString

method

-> MisoString

selector

-> params

params

-> (argument -> action)

successful

-> (MisoString -> action)

errorful

-> Effect context props model action 

https://lynxjs.org/api/lynx-api/nodes-ref/nodes-ref-invoke.html

Used to call methods on elements in view_, image_, etc. We use this internally to implement the various Method sections per the lynx docs.

invokeExec "gifs" "startAnimate" :: IO ()
lynx.createSelectorQuery()
  .select('#gifs')
  .invoke({
   method: startAnimate,
 }).exec();
invoke

enableDebugging :: IO () Source #

Turn on the native console→syslog bridge for on-device debugging.

On a physical device, background-thread console.* output is not printed to the platform log (iOS syslog / Android logcat) without a LynxDevTool connection. After calling this, every consoleError (and any other console.error) is mirrored — prefixed [miso] — through lynx.reportError, which the host does surface in the device log. Grep for [miso] in idevicesyslog (iOS) or adb logcat (Android).

Sets globalThis.debug = true; the bridge checks that flag per line, so this takes effect immediately even though it runs after startup. Enable it early (e.g. at the top of main) to capture diagnostics from the whole session.