mirror of
https://github.com/phfroidmont/scalive.git
synced 2025-12-25 13:36:59 +01:00
Add whenNot
This commit is contained in:
parent
5b1c71352e
commit
cdadafcfa4
1 changed files with 4 additions and 1 deletions
|
|
@ -7,7 +7,10 @@ trait LiveView[Model]:
|
||||||
opaque type Dyn[I, O] = I => O
|
opaque type Dyn[I, O] = I => O
|
||||||
extension [I, O](d: Dyn[I, O])
|
extension [I, O](d: Dyn[I, O])
|
||||||
def apply[O2](f: O => O2): Dyn[I, O2] = d.andThen(f)
|
def apply[O2](f: O => O2): Dyn[I, O2] = d.andThen(f)
|
||||||
def when(f: O => Boolean)(tag: HtmlTag[I]) = Mod.When(d.andThen(f), tag)
|
def when(f: O => Boolean)(tag: HtmlTag[I]): Mod.When[I] =
|
||||||
|
Mod.When(d.andThen(f), tag)
|
||||||
|
inline def whenNot(f: O => Boolean)(tag: HtmlTag[I]): Mod.When[I] =
|
||||||
|
when(f.andThen(!_))(tag)
|
||||||
def run(v: I): O = d(v)
|
def run(v: I): O = d(v)
|
||||||
object Dyn:
|
object Dyn:
|
||||||
def id[T]: Dyn[T, T] = identity
|
def id[T]: Dyn[T, T] = identity
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue