Module

Grain

Re-exports from Grain.Class

#NonKeyedGrain

class (Grain p a) <= NonKeyedGrain p a 

Instances

Re-exports from Grain.Class.GProxy

#GProxy

data GProxy a

Constructors

#GlobalGrain

class GlobalGrain a 

Representation of a partial state of application state.

You can use this to define global state.

TypeRef is used as state key internally for uniqueness.

Re-exports from Grain.Class.KGProxy

#KGProxy

data KGProxy k a

Constructors

#GrainKey

class GrainKey a 

Representation of key type for keyed global state.

This class's instances can be key for keyed global state.

Instances

#KeyedGlobalGrain

class (GrainKey k) <= KeyedGlobalGrain k a | a -> k

Representation of a partial state of application state.

You can use this to define global state with key for dynamic items.

The first parameter is a type of key for each item, and the second parameter is a type of item.

TypeRef is used as state key internally for uniqueness.

Re-exports from Grain.Class.LProxy

#LProxy

data LProxy a

Constructors

#LocalGrain

class LocalGrain a 

Representation of a component-local state.

TypeRef is used as state key internally for uniqueness.

Re-exports from Grain.TypeRef

#fromConstructor

fromConstructor :: forall a. a -> TypeRef

Create a TypeRef.

Treat a constructor function as reference of type.

Re-exports from Grain.UI

#VNode

data VNode

The type of virtual node.

#Render

newtype Render a

The type of component renderer.

In this monad, you can declare that you use some states and updaters.

Instances

#useValue

useValue :: forall p a. NonKeyedGrain p a => p a -> Render a

Listen a state, then return it.

If the state is changed, the component will be rerendered.

#useUpdater

useUpdater :: forall p a. NonKeyedGrain p a => p a -> Render ((a -> a) -> Effect Unit)

Get an updater of a state.

#usePortal

usePortal :: Effect Node -> Render (VNode -> VNode)

Get portal function.

#useKeyedValue

useKeyedValue :: forall k a. KeyedGlobalGrain k a => KGProxy k a -> k -> Render a

Listen a keyed global state, then return it.

If the state is changed, the component will be rerendered.

#useKeyedUpdater

useKeyedUpdater :: forall k a. KeyedGlobalGrain k a => KGProxy k a -> Render (k -> (a -> a) -> Effect Unit)

Get an updater of a keyed global state.

#useKeyedFinder

useKeyedFinder :: forall k a. KeyedGlobalGrain k a => KGProxy k a -> Render (k -> Effect a)

Get a finder of a keyed global state.

#useFinder

useFinder :: forall p a. NonKeyedGrain p a => p a -> Render (Effect a)

Get a finder of a state.

#mount

mount :: VNode -> Node -> Effect Unit

Mount a VNode to a parent node.

Modules