-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Reakt is a FRP library that supports observable values, observable lists, observable sets and observable maps. For all these types there are also bindings which represent values or collections that stay always synchronized with the source:
//create an observable variable with initial value 34
val x = obsVar(34)
//set x to 589
x.now = 589
//be notified when x changes
val o: Observer = x.observe { oldValue, newValue
println("x has been $oldValue and now is $newValue")
}
//prints "x has been 589 and now is 3493"
x.now = 3493
//stop observing x
o.kill()
//prints nothing
x.now = 0
//create a binding that always contains the square of x
val square = x.times(x)
assertEquals(0, square.now)
x.now = 12
assertEquals(0, square.now)
It is important to understand that when the documentation says that the binding holds the value _ then it is ment that this value is always in the rigth relation to the source(s)
To build ReaKt please clone the repository, import it into IntelliJ as a Maven project and then build it.observable values, observable lists, observable sets and observable maps. For all these types there are also bindings which represent values or collections that stay always synchronized with the source:
Contact: niko.knop003@gmail.com