Class SetSignalAction<T>

Type Parameters:
T - the type the signal holds and the JSON value is decoded to
All Implemented Interfaces:
Serializable

public class SetSignalAction<T> extends CallbackAction<T>
Named CallbackAction that calls set on a ValueSignal — the common case of bridging a client-side trigger into server-side signal state. For other server-side destinations (logging, custom events, queues, …) use CallbackAction directly with a method reference.

 ValueSignal<String> valueSignal = new ValueSignal<>("");
 DomEventTrigger input = new DomEventTrigger(textField, "input");
 input.triggers(new SetSignalAction<>(valueSignal, String.class,
         new PropertyInput<>(textField, "value", String.class)));
 

The signal's own equality checker debounces redundant updates, so emitting identical values back-to-back does not retrigger downstream effects.

For internal use only. May be renamed or removed in a future release.

See Also:
  • Constructor Details

    • SetSignalAction

      public SetSignalAction(ValueSignal<? super T> signal, Class<T> valueType, Action.Input<? extends T> source)
      Creates an action that, when the trigger fires, evaluates source on the client, sends the value to the server, decodes it as valueType, and assigns it to signal via ValueSignal.set(Object).
      Parameters:
      signal - the local value signal to update on the server, not null
      valueType - runtime type the JSON value is decoded to before being passed to ValueSignal.set(Object), not null
      source - input that produces the value on the client when the trigger fires, not null