Event decoder utilities
For maximum performance, event handlers attached to the virtual DOM should be comparable by object identity. For this, you have call on with a top level function event decoder.
This module defines composable BrowserEvents and utility functions that use them. For maximum performance, you should define your own toplevel helpers with a composed BrowserEvent of your choice.
-- convenient but not optimal for handlers that get used a lot onInput MyMsg -- good because will compare equal myMsgDecoder = (f2cmd pureCommand <<< map f <<< targetValueEvent) onInputMyMsg = on "input" myMsgDecoder
Re-exports from Bonsai.
newtype Property msg
When using HTML and JS, there are two ways to specify parts of a DOM node.
Attributes — You can set things in HTML itself. So the
<div class="greeting"></div>is called an attribute.
Properties — You can also set things in JS. So the
div.className = 'greeting'is called a property.
class attribute corresponds to the
className property. At first
glance, perhaps this distinction is defensible, but it gets much crazier.
There is not always a one-to-one mapping between attributes and properties!
Yes, that is a true fact. Sometimes an attribute exists, but there is no
corresponding property. Sometimes changing an attribute does not change the
underlying property. For example, as of this writing, the
attribute can be used in HTML, but there is no corresponding property!
Options for an event listener. If
stopPropagation is true, it means the
event stops traveling through the DOM so it will not trigger any other event
preventDefault is true, any built-in browser behavior related
to the event is prevented. For example, this is used with touch events when you
want to treat them as gestures of your own, not as scrolls.