Skip to content
This repository has been archived by the owner on Oct 21, 2020. It is now read-only.

Commit

Permalink
add If markup
Browse files Browse the repository at this point in the history
  • Loading branch information
nobonobo committed Jul 8, 2020
1 parent 2c0515e commit 4b1be45
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions wecty.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,28 @@ func (c Class) apply(node js.Wrapper) {
}
}

type noApply struct{}

func (n noApply) apply(node js.Wrapper) {}

// ifMarkup ...
type ifMarkup struct {
Cond bool
Markup Markup
}

func (s ifMarkup) markup() Applyer {
if s.Cond {
return s.Markup.markup()
}
return noApply{}
}

// If ...
func If(cond bool, m Markup) Markup {
return ifMarkup{Cond: cond, Markup: m}
}

// eventMarkup ...
type eventMarkup struct {
name string
Expand Down

0 comments on commit 4b1be45

Please sign in to comment.