observable

The observable function gives you a delegate property that accepts a function that will be invoked each time a property changes:

var observable by Delegates.observable(1) { prop, oldVal, newVal ->
println("Observable property changed from $oldVal to $newVal")
}

If we now change the property, the lambda function will be invoked:

//this prints Observable property changed from 1 to 0
observable = 0
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.242.24