Pro.ObservableMutable

trait ObservableMutable[A] extends Pro.O[A] with Pro.M[A]

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 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

def apply(): A

Get value

Get value

Returns property value

   val pro: Pro.M[String] = Pro.M[String]("abc")

   val v1 = pro.apply() // Regular call
   val v2 = pro()       // Scala "syntactic sugar" call
Inherited from
Pro
Source
__.scala
def onChange[U](l: () => U): Event.Control

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
def onObservableChange[U](l: () => U): Event.Control
Inherited from
Observable
Source
__.scala
def update(v: A): Unit

Updates value

Updates value

Updates property value

   val pro: Pro.M[String] = Pro.M[String]("")

   pro.update("abc") // Regular call

   pro() = "abc"     // Scala "syntactic sugar" call
Inherited from
Mutable
Source
__.scala

Extension

def mutableMapView[A](m: A => B, r: B => A): Pro.OM[B]
Source
__.scala
def mutableMapView[A](using m: TwoWayFunction[A, B]): Pro.OM[B]
Source
__.scala