@@ -28,7 +28,7 @@ Widgets may return any type (this is 'a' in many of the functions below). Often
28-- This version returns the 'El' as well.
28-- This version returns the 'El' as well.
29[W] el' :: Text -> m a -> m (El, a)
29[W] el' :: Text -> m a -> m (El, a)
31−-- These two additionally apply attributes to the element, such as ("class" =: "blah")
31+-- These two additionally apply attributes to the element, such as ("class" =: "blah"). (=:) is 'Map.singleton'
32[W] elAttr :: Text -> Map Text Text -> m a -> m a
32[W] elAttr :: Text -> Map Text Text -> m a -> m a
33[W] elAttr' :: Text -> Map Text Text -> m a -> m (El, a)
33[W] elAttr' :: Text -> Map Text Text -> m a -> m (El, a)
@@ -36,13 +36,16 @@ Widgets may return any type (this is 'a' in many of the functions below). Often
36[W] elDynAttr :: Text -> Dynamic (Map Text Text) -> m a -> m a
36[W] elDynAttr :: Text -> Dynamic (Map Text Text) -> m a -> m a
37[W] elDynAttr' :: Text -> Dynamic (Map Text Text) -> m a -> m (El, a)
37[W] elDynAttr' :: Text -> Dynamic (Map Text Text) -> m a -> m (El, a)
39+-- As above, but with an optional XML namespace for the tag. Note that this does *not* set the 'xmlns' attribute. See https://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-DocCrElNS
40+[W] elDynAttrNS' :: Maybe Text -> Text -> Dynamic (Map Text Text) -> m a -> m (El, a)
39-- Shortcut for elAttr when you only want to set the "class" attribute.
42-- Shortcut for elAttr when you only want to set the "class" attribute.
40[W] elClass :: Text -> Text -> m a -> m a
43[W] elClass :: Text -> Text -> m a -> m a
42-- Even shorter-cut for above when element type is "div". Create a div of given class.
45-- Even shorter-cut for above when element type is "div". Create a div of given class.
43[W] divClass :: Text -> m a -> m a
46[W] divClass :: Text -> m a -> m a
45−-- Create a widget of given type with arbitrary, Dymamic HTML inside.
48+-- Create a widget of given type with arbitrary, Dynamic HTML inside.
46[W] elDynHtml' :: Text -> Dynamic Text -> m El
49[W] elDynHtml' :: Text -> Dynamic Text -> m El
47[W] elDynHtmlAttr' :: Text -> Map Text Text -> Dynamic Text -> m El
50[W] elDynHtmlAttr' :: Text -> Map Text Text -> Dynamic Text -> m El
@@ -72,32 +75,10 @@ Note the "list" functions do not imply particular HTML tags (ul, li, etc), thoug
73-- Same as dyn, but takes initial value and an update Event instead of a Dynamic.
76-- Same as dyn, but takes initial value and an update Event instead of a Dynamic.
74[W] widgetHold :: m a -> Event (m a) -> m (Dynamic a)
77[W] widgetHold :: m a -> Event (m a) -> m (Dynamic a)
76−-- Turn a Dynamic key/value map into a set of dynamically-changing widgets.
77−[W] listWithKey :: Ord k =>
78− Dynamic (Map k v) -> (k -> Dynamic v -> m a ) -> m (Dynamic (Map k a))
80−-- Same as above where the widget constructor doesn't care about the key.
82− Dynamic (Map k v) -> ( Dynamic v -> m a ) -> m (Dynamic (Map k a))
84−-- Even simpler version where there are no keys and we just use a list.
86− Dynamic [v] -> ( Dynamic v -> m a ) -> m (Dynamic [a])
88−-- Like listWithKey specialized for widgets returning (Event a).
89−[W] listViewWithKey :: Ord k =>
90− Dynamic (Map k v) -> (k -> Dynamic v -> m (Event a)) -> m (Event (Map k a))
92−-- Create a dynamically-changing set of widgets, one of which is selected at any time.
93−[W] selectViewListWithKey_ :: Ord k => Dynamic k ->
94− Dynamic (Map k v) -> (k -> Dynamic v -> Dynamic Bool -> m (Event a)) -> m (Event k)
96−-- Same as listWithKey, but takes initial values and an updates Event instead of a Dynamic.
97−[W] listWithKey' :: Ord k =>
98− Map k v -> Event (Map k (Maybe v)) -> (k -> v -> Event v -> m a) -> m (Dynamic (Map k a))
80+Also see the "Collection management functions" section in the `reflex` Quick Reference.
101### Utility widgets
82### Utility widgets
103These are useful widgets that are implemented (or could be implemented) in terms of the low-level widgets above.
84These are useful widgets that are implemented (or could be implemented) in terms of the low-level widgets above.
@@ -132,27 +113,12 @@ Some of these widget builders take a configuration record and return a record co
133## Connecting to the real world (I/O)
114## Connecting to the real world (I/O)
135−### Connecting to DOM events
137```haskell
116```haskell
138-- Extract the specified Event from an 'El'. See Reflex.Dom.Widget.Basic
117-- Extract the specified Event from an 'El'. See Reflex.Dom.Widget.Basic
139[ ] domEvent :: EventName en -> El -> Event (EventResultType en)
118[ ] domEvent :: EventName en -> El -> Event (EventResultType en)
142−### Performing arbitrary I/O in response to Events
121+Also see the "Connection to the real world" and "Time" sections in the `reflex` Quick Reference.
145−-- Run side-effecting actions in Event when it occurs; returned Event contains
146−-- results. Side effects run in (WidgetHost m) monad, which includes [S] and [H]
147−-- and can also do I/O via liftIO
148−[W] performEvent :: Event ( WidgetHost m a) -> m (Event a)
150−-- Just run side-effects; no return Event
151−[W] performEvent_ :: Event ( WidgetHost m ()) -> m ()
153−-- Actions run asynchronously; actions are given a callback to send return values
154−[W] performEventAsync :: Event ((a -> IO ()) -> WidgetHost m ()) -> m (Event a)
157### XMLHttpRequest
123### XMLHttpRequest
@@ -175,16 +141,6 @@ Convenience functions for XMLHttpRequest. see Reflex.Dom.Xhr
175[W] getAndDecode :: FromJSON a => Event Text -> m (Event (Maybe a))
141[W] getAndDecode :: FromJSON a => Event Text -> m (Event (Maybe a))
181−-- Create Event at given interval with given basis time.
182−[W] tickLossy :: NominalDiffTime -> UTCTime -> m (Event t TickInfo)
184−-- Delay an Event's occurrences by a given amount in seconds.
185−[W] delay :: NominalDiffTime -> Event t a -> m (Event t a)
188## Startup
144## Startup
190```haskell
146```haskell
@@ -198,7 +154,6 @@ Convenience functions for XMLHttpRequest. see Reflex.Dom.Xhr
198[I] mainWidgetWithCss ::
154[I] mainWidgetWithCss ::
199 ByteString ->
155 ByteString ->
200 Widget Spider (Gui Spider (WithWebView SpiderHost) (HostFrame Spider)) () -> IO ()
156 Widget Spider (Gui Spider (WithWebView SpiderHost) (HostFrame Spider)) () -> IO ()
202−-- One-shot Event that is triggered once all initial widgets are built
203−[W] getPostBuild :: m (Event ())
159+Also see the corresponding section in the `reflex` Quick Reference.