For a value source without change event, periodically check it to invoke an event when changed. More...
Public Member Functions | |
| PeriodicInquirer () | |
| Create an inquirer for setup each behavior and start manually. More... | |
| PeriodicInquirer (Func< T > inquirer, Action< T, T > onUpdated, float interval=0f, bool start=true) | |
| Create an inquirer with common settings, optional to start immediately. More... | |
| void | Stop () |
| Stop running periodic checking. More... | |
| void | Start () |
| Start running periodic checking. More... | |
Public Attributes | |
| float | interval |
| The interval seconds to check the value. More... | |
| Func< T > | inquirer |
| The callback to get the current value. More... | |
| Func< bool > | stopper |
| The callback to check if to stop, default not to stop automatically. More... | |
| bool | running => null != _coroutiner && !_coroutiner.isDone |
| Determine if currently running. More... | |
Properties | |
| T | current [get] |
| Get the current value. More... | |
Events | |
| Action< T, T > | onUpdated = (old, now) => {} |
| The event invoked when the value updated. More... | |
For a value source without change event, periodically check it to invoke an event when changed.
| T | The value type. |
| PeriodicInquirer | ( | ) |
Create an inquirer for setup each behavior and start manually.
| PeriodicInquirer | ( | Func< T > | inquirer, |
| Action< T, T > | onUpdated, | ||
| float | interval = 0f, |
||
| bool | start = true |
||
| ) |
Create an inquirer with common settings, optional to start immediately.
| inquirer | The callback to get the current value. |
| onUpdated | The event invoked when the value updated. |
| interval | The interval seconds to check the value. |
| start | If to start immediately. |
| void Stop | ( | ) |
Stop running periodic checking.
| void Start | ( | ) |
Start running periodic checking.
| float interval |
The interval seconds to check the value.
| Func<T> inquirer |
The callback to get the current value.
| Func<bool> stopper |
The callback to check if to stop, default not to stop automatically.
| bool running => null != _coroutiner && !_coroutiner.isDone |
Determine if currently running.
|
get |
Get the current value.
| Action<T, T> onUpdated = (old, now) => {} |
The event invoked when the value updated.
First invoked when Start(), both parameters are the current value. Then every time the value changed, invoked with the last and the current value.