-
Notifications
You must be signed in to change notification settings - Fork 11
/
Interfaces.cs
84 lines (72 loc) · 2.36 KB
/
Interfaces.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System;
using System.Threading;
namespace UniMob
{
// ReSharper disable once InconsistentNaming
public interface Atom<out T>
{
/// <summary>
/// Gets the value of the current Atom instance.<br/>
/// </summary>
T Value { get; }
/// <summary>
/// Suspends tracking the value of the current Atom and clean up all subscriptions.<br/>
/// Note, that tracking of the Atom will be restarted if its value is read after deactivation.
/// </summary>
void Deactivate();
/// <summary>
/// Makes Atom invalid, so it value will be recalculated the next time you try to get it.<br/>
/// Unlike Deactivate, this method does not clean up atom subscriptions
/// and the atom will continue to work as usual.
/// </summary>
void Invalidate();
}
// ReSharper disable once InconsistentNaming
public interface MutableAtom<T> : Atom<T>
{
/// <summary>
/// Gets the value of the current Atom instance.<br/>
/// </summary>
new T Value { get; set; }
}
// ReSharper disable once InconsistentNaming
public interface Reaction
{
/// <summary>
/// Starts reaction.
/// </summary>
/// <param name="force"></param>
void Activate(bool force = false);
/// <summary>
/// Suspends reaction and clean up all subscriptions.<br/>
/// Note, that reaction will be restarted if it will be activated again.
/// </summary>
void Deactivate();
}
// ReSharper disable once InconsistentNaming
public interface AtomSink<T>
{
void SetValue(T value);
void SetException(Exception exception);
}
#if UNIMOB_EXPERIMENTAL_ASYNC_ATOM
// ReSharper disable once InconsistentNaming
public interface AsyncAtom<T> : Atom<AtomAsyncValue<T>>
{
void Reload(bool clearValue = true);
}
#endif
[Obsolete("ILifetimeController is obsolete. Use LifetimeController instead")]
public interface ILifetimeController : IDisposable
{
bool IsDisposed { get; }
Lifetime Lifetime { get; }
void Register(Action action);
void Register(IDisposable disposable);
CancellationToken ToCancellationToken();
}
public interface ILifetimeScope
{
Lifetime Lifetime { get; }
}
}