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.Element.Frame.Event

Description

 
Synopsis

Events

onLoad :: (FrameLoadEvent -> action) -> Attribute model action Source #

https://lynxjs.org/api/elements/built-in/frame.html#bindload

data Action = HandleLoad FrameLoadEvent

view :: context -> props -> Model -> View context Action
view _ _ model = frame_ [ src_ "http://url", onLoad HandleLoad ] []

update :: Action -> Effect props Model Action
update (HandleLoad FrameLoadEvent {..}) =
  io_ (consoleLog "frame load event received")

onLoadWith :: (FrameLoadEvent -> DOMRef -> action) -> Attribute model action Source #

Like onLoad, but the handler also receives the target element's DOMRef. Use for main-thread (MTS) handlers that imperatively mutate the element.

onLoadMain :: (FrameLoadEvent -> action) -> EventHandler model action Source #

Like onLoad, but dispatched on the Lynx main thread (MTS).

Runs imperatively on the MTS (no VDOM diff). Meant to be used with -XStaticPointers.

data Action = HandleLoad FrameLoadEvent

view_ [ event (static (onLoadMain HandleLoad)) ] [ "some view" ]

onLoadMainWith :: (FrameLoadEvent -> model -> DOMRef -> action) -> EventHandler model action Source #

Like onLoadMain, but the handler also receives read-only access to the model and the target element's DOMRef (for imperative MTS mutation).

data Action = HandleLoad FrameLoadEvent Model DOMRef

view_ [ event (static (onLoadMainWith HandleLoad)) ] [ "some view" ]

onLoadMetrics :: (FrameLoadMetricsEvent -> action) -> Attribute model action Source #

https://lynxjs.org/api/elements/built-in/frame.html#bindloadmetrics

data Action = HandleMetrics FrameLoadMetricsEvent

view :: context -> props -> Model -> View context Action
view _ _ model = frame_ [ src_ "http://url", onLoadMetrics HandleMetrics ] []

update :: Action -> Effect props Model Action
update (HandleMetrics FrameLoadMetricsEvent {..}) =
  io_ (consoleLog "frame load metrics event received")

onLoadMetricsWith :: (FrameLoadMetricsEvent -> DOMRef -> action) -> Attribute model action Source #

Like onLoadMetrics, but the handler also receives the target element's DOMRef. Use for main-thread (MTS) handlers that imperatively mutate the element.

onLoadMetricsMain :: (FrameLoadMetricsEvent -> action) -> EventHandler model action Source #

Like onLoadMetrics, but dispatched on the Lynx main thread (MTS).

Runs imperatively on the MTS (no VDOM diff). Meant to be used with -XStaticPointers.

data Action = HandleMetrics FrameLoadMetricsEvent

view_ [ event (static (onLoadMetricsMain HandleMetrics)) ] [ "some view" ]

onLoadMetricsMainWith :: (FrameLoadMetricsEvent -> model -> DOMRef -> action) -> EventHandler model action Source #

Like onLoadMetricsMain, but the handler also receives read-only access to the model and the target element's DOMRef (for imperative MTS mutation).

data Action = HandleMetrics FrameLoadMetricsEvent Model DOMRef

view_ [ event (static (onLoadMetricsMainWith HandleMetrics)) ] [ "some view" ]

Types

data FrameLoadEvent Source #

https://lynxjs.org/api/elements/built-in/frame.html#bindload

Triggered when the embedded <frame> page finishes loading.

Constructors

FrameLoadEvent 

Fields

data FrameLoadMetricsEvent Source #

https://lynxjs.org/api/elements/built-in/frame.html#bindloadmetrics

Triggered with performance metrics for the embedded <frame> page load.

Constructors

FrameLoadMetricsEvent 

Fields

Decoders

Event Map