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
even though it might clutter the Signals class a bit, I think your proposal adds value in usability and helps readability when not wanting to cache the signal (which has a performance benefit, when using the signal extensively.
This would be the changes syntax with all its use cases
// Add signals// FromSignals.Get<BasicExampleSignal>().AddListener(DefaultListener);Signals.Get<BasicExampleSignal>().AddListener(FirstListener,-100);// ToSignals.AddListener<BasicExampleSignal>(DefaultListener);Signals.AddListener<BasicExampleSignal>(FirstListener,-100);// Remove signals// FromSignals.Get<BasicExampleSignal>().RemoveListener(DefaultListener);// ToSignals.RemoveListener<BasicExampleSignal>(DefaultListener);// Dispatching with support to up to three parameters// FromSignals.Get<NoArgumentSignalTest>().Dispatch();Signals.Get<OneArgumentSignalTest>().Dispatch(t);Signals.Get<TwoArgumentSignalTest>().Dispatch(t,u);Signals.Get<ThreeArgumentSignalTest>().Dispatch(t,u,v);// ToSignals.Dispatch<NoArgumentSignalTest>();Signals.Dispatch<OneArgumentSignalTest>(t);Signals.Dispatch<TwoArgumentSignalTest>(t,u);Signals.Dispatch<ThreeArgumentSignalTest>(t,u,v);// Additional functionality// FromSignals.Get<BasicExampleSignal>().Pause();// ToSignals.Pause<BasicExampleSignal>();// FromSignals.Get<BasicExampleSignal>().Continue();// ToSignals.Continue<BasicExampleSignal>();// FromSignals.Get<BasicExampleSignal>().Consume();// ToSignals.Consume<BasicExampleSignal>();
Hi,
I propose a static interface to reduce the Signals.Get() overhead, when I just want to add quick Listeners to events.
e.g.
When dispatching signals with parameters, the interface would be a little cluttered (but typesafe and consistent). Not sure if it's needed though.
I would also like to look into this myself
The text was updated successfully, but these errors were encountered: