Package space.maxus.flare.react
Interface ReactivityProvider
- All Known Implementing Classes:
Frame,FunctionComposable,Modal.ModalFrame,PageFrame,PaginatedFrame,ParamFrame,ParamPaginatedFrame,SimpleFrame
public interface ReactivityProvider
ReactivityProvider is an interface that provides access to some utility hooks
-
Method Summary
Modifier and TypeMethodDescriptiondefault <V> ReactiveState<V>useBoundState(V initial) Constructs a new ReactiveState bound to this object
**Experimental**: This is an experimental hook, and it may change or be removed in the futuredefault <I,O> org.apache.commons.lang3.concurrent.Computable<I, O> useMemo(@NotNull ReactiveState<I> dependency, @NotNull org.apache.commons.lang3.concurrent.Computable<I, O> computable) Memoizes a Computable, so it is only recalculated on state change.<V> ReactiveState<V>useState(V initial) Constructs a new ReactiveStatedefault <V> ReactiveState<V>useUnboundState(V initial) Constructs a new ReactiveState that is **explicitly** not bound to this object
-
Method Details
-
useState
Constructs a new ReactiveState- Type Parameters:
V- Type of the value inside state- Parameters:
initial- Initial value of the state- Returns:
- A new ReactiveState
-
useBoundState
Constructs a new ReactiveState bound to this object
**Experimental**: This is an experimental hook, and it may change or be removed in the future- Type Parameters:
V- Type of the value inside state- Parameters:
initial- Initial value of the state- Returns:
- A new ReactiveState
-
useUnboundState
Constructs a new ReactiveState that is **explicitly** not bound to this object- Type Parameters:
V- Type of the value inside state- Parameters:
initial- Initial value of the state- Returns:
- A new ReactiveState
-
useMemo
default <I,O> org.apache.commons.lang3.concurrent.Computable<I,O> useMemo(@NotNull @NotNull ReactiveState<I> dependency, @NotNull @NotNull org.apache.commons.lang3.concurrent.Computable<I, O> computable) Memoizes a Computable, so it is only recalculated on state change.- Type Parameters:
I- Type of value inside dependencyO- Type of output value- Parameters:
dependency- Dependency to watch for changescomputable- Computable to memoize- Returns:
- A memoized computable
-