- Source
- __.scala
Def
Cancel the event
Cancel the event
Returns true if cancelation is a success, false if the event was already cancelled before.
- Source
- __.scala
Conditionally cancel
Conditionally cancel
Adds check to conditionally cancell the event. It will be evaluated at least before each event execution.
- Source
- __.scala
Conditionally cancel
Conditionally cancel
Adds check to conditionally cancell the event. It will be evaluated at least before each event execution.
- Source
- __.scala
Conditionally cancel
Conditionally cancel
Adds check to conditionally cancell the event. It will be evaluated at least before each event execution.
- Source
- __.scala
Cancel in given time
Cancel in given time
Adds check to conditionally cancell the event when given time length passes.
- Source
- __.scala
Make event weak referenced
Make event weak referenced
Event processing logic (usually wrapped in a function) may reference other objects, which cannot be garbage collected while the event exists.
This method wraps the controlled event into a WeakReference, so the event itself and all the contained objects may be garbage collected. When the event is garbage collected it is effectively cancelled.
The returned object is the only hard refference to the event and the program can decide when to discard it.
val idx = Idx.OM[Int]()
var hardRef = idx.onChange(_.stream.print).removeHardReference
System.gc
idx += 1 // The onChange event will be printed out, because hard refference is kept
hardRef = null
System.gc
idx += 2 // The onChange event should be gone (cancelled), because refference is lost.
- Source
- __.scala