Read/write/listenTo Property`
The usual implementation looks like:
class Foo:
val namePro : Pro.OM[String] = String.Pro.OM("")
def name : String = namePro()
def name_=(v:String): Unit = namePro() = v
val barPro : Int.Pro.OM = Int.Pro.OM(0)
def bar : Int = valuePro()
def bar_=(v:Int) : Unit = valuePro() = v
- Source
- __.scala
trait Pro.Mutable[Pro.ObservableMutable.A]
trait Pro.Observable[Pro.ObservableMutable.A]
trait Observable
trait Pro[Pro.ObservableMutable.A]
class java.lang.Object
trait scala.Matchable
class Any
class Pro.ObservableMutable.X.Abstract[Pro.ObservableMutable.X.Abstract.A]
class Pro.ObservableMutable.X.Basic[Pro.ObservableMutable.X.Basic.A]
trait Pro.ObservableMutable.X.Base[Pro.ObservableMutable.X.Base.A]
Def
On change subscription
On change subscription
Adds given function as listener to property change events
val pro = String.Pro.OM("foo")
// event subscription
pro.onChange(() => "Change Detected".tp)
// library based event subscription
pro.onValueChangeWithOld((v, old) => "Value changed from " + old + " to " + v tp()))
pro() = "bar"
// Output
Value changed from foo to bar
Change Detected
- Inherited from
- Observable
- Source
- __.scala