Method | Description | |
---|---|---|
Reaction ( UniMob.Lifetime lifetime, Action reaction, Action exceptionHandler = null, string debugName = null ) : Reaction |
Creates an reaction that should run every time anything it observes changes. It also runs once when you create the reaction itself. It only responds to changes in observable state, things you have annotated atom.
|
|
Reaction ( UniMob.Lifetime lifetime, Func data, Action effect, Action exceptionHandler = null, bool fireImmediately = true, string debugName = null ) : Reaction |
Creates an reaction that takes two functions: the first, data function, is tracked and returns the data that is used as input for the second, effect function. It is important to note that the side effect only reacts to data that was accessed in the data function, which might be less than the data that is actually used in the effect function. The typical pattern is that you produce the things you need in your side effect in the data function, and in that way control more precisely when the effect triggers.
|
public static Reaction ( UniMob.Lifetime lifetime, Action reaction, Action exceptionHandler = null, string debugName = null ) : Reaction | ||
lifetime | UniMob.Lifetime | Reaction lifetime. |
reaction | Action | A function for reaction. |
exceptionHandler | Action | A function that called when an exception is thrown while computing an reaction. |
debugName | string | Debug name for this reaction. |
return | Reaction |
public static Reaction ( UniMob.Lifetime lifetime, Func data, Action effect, Action exceptionHandler = null, bool fireImmediately = true, string debugName = null ) : Reaction | ||
lifetime | UniMob.Lifetime | Reaction lifetime. |
data | Func | A data function. |
effect | Action | A side effect function. |
exceptionHandler | Action | A function that called when an exception is thrown while computing an reaction. |
fireImmediately | bool | Should the side effect runs once when you create a reaction itself? Default value is true. |
debugName | string | Debug name for this reaction. |
return | Reaction |