You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, when a Signal is published, there's no data attached to it.
Subscribers are informed that the publish happened, but it's up to them to go off and fetch any associated data.
Often that data is associated with the node that published it, so the subscriber is having to know how to access data from the publisher and is coupled to it. Ideally we'd avoid this coupling as it's one of the main benefits of a pubsub system.
It'd be nice to offer a means for publish to an optional extra piece of data to the subscribers callback.
To retain typing, Signal would become generic.
Example:
# Creation of a signalconfig_changed_signal=Signal[Config](self, "config-changed")
# Publishing that signalconfig_changed_signal.publish(Config(a=1, b=2))
# A callback to run when the signal is publisheddefcallback(config: Config) ->None:
"""Does something with the Config object"""# Subscribing and passing in the callbackconfig_changed_signal.subscribe(self, callback)
The text was updated successfully, but these errors were encountered:
Right now, when a Signal is published, there's no data attached to it.
Subscribers are informed that the publish happened, but it's up to them to go off and fetch any associated data.
Often that data is associated with the node that published it, so the subscriber is having to know how to access data from the publisher and is coupled to it. Ideally we'd avoid this coupling as it's one of the main benefits of a pubsub system.
It'd be nice to offer a means for
publish
to an optional extra piece of data to the subscribers callback.To retain typing, Signal would become generic.
Example:
The text was updated successfully, but these errors were encountered: