Returns the current signal value version. This value is used to determine if a dependency has changed. The most simple implementation would be a number
which is incremented every time the signal value really has changed. The version type doesn't matter but must be comparable with ===
.
The current signal value version.
Checks if signal value is still valid. When signal has no dependencies then this method can always return true. If signal has dependencies then it must check if any dependency has changed or became invalid. If yes, then this method must return false and the signal will be re-validated by calling (). If all dependency are valid/unchanged then this method must return true to indicate that the signal value is still valid.
True if signal value is valid, false if it must be re-validated.
Called when () returned false and the current value of this signal is needed. Must compute/fetch and cache the new value so the next call to () returns a valid value. When signal has no dependencies and () is implemented to always return true then this method can stay empty as it has nothing to validate/update.
Signal interface which in addition to the base signal contract also allows calling the signal as a function to get the current value, so calling
signal()
does the same as callingsignal.get()
.