Skip to content
This repository has been archived by the owner on May 29, 2023. It is now read-only.

Commit

Permalink
Add some more comments on API functions
Browse files Browse the repository at this point in the history
Just filling in some of the holes in documentation. Long term, it would
be better to cut down these comments and put more effort into the
project wiki, I think.
  • Loading branch information
Tom Harding committed Apr 30, 2018
1 parent 7dc59fc commit 90bbb29
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Panda/Builders/Components.purs
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,9 @@ make tagName properties children
, children
}

-- | Make a "collection" element from some container. These are collections in
-- | the Panda sense - element containers that are open to incremental updates.

collection String Collection
collection tagName properties watcher
= Types.Collection
Expand Down
7 changes: 7 additions & 0 deletions src/Panda/Builders/Property/Watchers.purs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ module Panda.Builders.Property.Watchers where

import Panda.Internal.Types as Types

-- | Watch for changes in state and update accordingly. Note that adding a
-- | property will remove any previously-set properties, so it is advised that
-- | you use independent `watch` values for each property that is dynamic.

watch
update state event
. ( { updateupdate, statestate }
Expand All @@ -12,6 +16,9 @@ watch
watch listener
= Types.Dynamic listener

-- | Given a predicate on the state and update, this function will recompute a
-- | value whenever the predicate yields true.

when
update state event
. ({ updateupdate, statestate } Boolean)
Expand Down
5 changes: 5 additions & 0 deletions src/Panda/Incremental/Collection.purs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@ import Panda.Internal.Types as Types

import Panda.Prelude

-- | Convenience synonym for incremental renderers.

type Renderer update state event
= Types.Component update state event
Effect
{ node DOM.Node
, system Maybe (Types.EventSystem update state event)
}

-- | Execute an incremental `update` on the children of some `parent`, along
-- | with their `systems`, and `render` any new inserts.

execute
update state event
. { parentDOM.Node
Expand Down
3 changes: 3 additions & 0 deletions src/Panda/Render/Component.purs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import Partial.Unsafe (unsafePartial)

import Panda.Prelude

-- | Given a DOM document and a bootstrapping function, render a component to
-- | a DOM node, along with the corresponding event system.

render
update state event
. DOM.Document
Expand Down
4 changes: 4 additions & 0 deletions src/Panda/Render/Property.purs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ renderDynamic element watcher = do
effToEffect (Ref.writeRef propertyRef updated)
}

-- | Given an element, along with some property DSL value, render the
-- | calculated property to the element, which may involve some handling of
-- | event listeners.

render
update state event
. DOM.Element
Expand Down

0 comments on commit 90bbb29

Please sign in to comment.