VM
Size: a a a
VM
E
p
data Page0Slot = Page0Slot
derive instance page0SlotEq :: Eq Page0Slot
derive instance page0SlotOrd :: Ord Page0Slot
data Page1Slot = Page1Slot
derive instance page1SlotEq :: Eq Page1Slot
derive instance page1SlotOrd :: Ord Page1Slot
type ChildSlot = Either2 Page0Slot Page1Slot
VY
p
data Slot
= Page0Slot
| Page1Slot
derive instance slotEq :: Eq Slot
derive instance slotOrd :: Ord Slot
type ChildSlot = Either2 Slot Slot
p
VY
type ChildSlots =
( a :: H.Slot CA.Query Void Unit
, b :: H.Slot CB.Query Void Unit
, c :: H.Slot CC.Query Void Unit
)
_a = SProxy :: SProxy "a"
_b = SProxy :: SProxy "b"
_c = SProxy :: SProxy "c"
p
p
VY
-- | Query algebra for direct children of the root component,на Halogen v4, пока тоже не переехал
-- | represented as a `Coproduct`.
type ChildQuery
= Home.Query
<\/> Register.Query
<\/> Login.Query
<\/> ImportForm.Query
<\/> EditForm.Query
<\/> ViewForm.Query
<\/> Profile.Query
<\/> Settings.Query
<\/> About.Query
<\/> Dialog.Query
<\/> Navigation.Query
<\/> Const Void
-- | Slot type for child pages.
type ChildSlot
= Home.Slot
\/ Register.Slot
\/ Login.Slot
\/ ImportForm.Slot
\/ EditForm.Slot
\/ ViewForm.Slot
\/ Profile.Slot
\/ Settings.Slot
\/ About.Slot
\/ Dialog.Slot
\/ Navigation.Slot
\/ Void
p
VY
data Query a = Unit aпримерно одно и тоже в каждом компоненте, в завсимости от нужд
type Input = Unit
type Output = Void
type State = Unit
data Slot = Slot
derive instance eqSlot ∷ Eq Slot
derive instance ordSlot ∷ Ord Slot
type Component = H.Component HH.HTML Query Input Output
type DSL = H.ComponentDSL State Query Output
type HTML = H.ComponentHTML Query
page ∷ ∀ m. Component m
...
p
VY
type Input = Dialog
data Query a
= Initialize a
| Finalize a
| HandleClose a
| HandleAction Int a
| HandleKey KeyboardEvent (SubscribeStatus → a)
type State = Input
data Output
= Close
| Action Int
data Slot = Slot
derive instance eqSlot ∷ Eq Slot
derive instance ordSlot ∷ Ord Slot
type Component = H.Component HH.HTML Query Input Output
type DSL = H.ComponentDSL State Query Output
type HTML = H.ComponentHTML Query
dialog ∷ ∀ m. MonadAff m ⇒ Component m
VY
VY
p
VY
p
Care should be taken to avoid using the same slot address for multiple child components. The resulting behaviour is undefined... but almost certainly won't be good. If duplicate slot values are detected a warning message will be logged in the browser console.|
type ChildSlot = Either3 Unit Unit Unit
Here we are just using Unit for each of the slots since the example only uses one instance of each child component...