GodotSx
GodotSx provides reactive extensions for Godot 4's signal system, enabling Rx-style operations like merging and filtering signals. It's a lightweight alternative to full Rx implementations, offering essential reactive functionalities without the overhead.
https://github.com/TheWalruzz/godot-sxGodotSx: Reactive Signal Extensions for Godot 4
GodotSx is a lightweight library designed to extend Godot 4's built-in signal system with reactive programming capabilities. It allows developers to perform operations on signals in an Rx-like manner, such as merging, filtering, and mapping, without the complexity of a full Rx implementation.
Key Features
- Signal Manipulation: Enables basic operations on regular Godot signals, treating them as reactive streams.
- Lightweight: Avoids the overhead of full Rx frameworks, providing only essential reactive functionalities.
- Filtering and Mapping: Allows filtering and mapping of emitted items, similar to Rx implementations.
- Merging Signals: Supports merging multiple Godot signals into one.
- Timers: Simplifies the creation of periodic interval timers.
- Debouncing and Throttling: Provides operators to debounce or throttle signal emissions.
- Scan Operator: Allows scanning and buffering incoming values inside a stateful operator.
- Subscription Disposal: Offers manual and automatic disposal of subscriptions to prevent memory leaks.
-
Reactive Properties: Includes
SxProperty
,SxSignalProperty
,SxArrayProperty
, andSxDictionaryProperty
for reactive data management.
Usage
GodotSx is installed as a plugin and provides a singleton Sx
for accessing its functionalities. Signals can be converted to SxSignal
for applying reactive operations. The library supports signals with up to 6 arguments and provides various operators for manipulating signal emissions.
Alternatives
While GodotSx offers a simplified approach, the project documentation suggests GodotRx for more comprehensive Rx implementations, if more complex needs are required.