pubsub icon indicating copy to clipboard operation
pubsub copied to clipboard

Documentation - Unsubscribe example should include 'this' parameter

Open RobbiewOnline opened this issue 3 years ago • 0 comments

Because your example for subscribing passes this then I recommend changing the unsubscribe documentation to match, i.e. from

public class Page
{
	Hub hub = Hub.Default;
	
	public void WereDoneHere()
	{
		hub.Unsubscribe<Product>();
	}
}

to

public class Page
{
	Hub hub = Hub.Default;
	
	public void WereDoneHere()
	{
		hub.Unsubscribe<Product>(this);
	}
}

Otherwise those using the current example as-is (copy & paste) will likely accidentally unsubscribe all their listeners from the hub in error, rather than from their specific object / subscriber instance.

RobbiewOnline avatar Mar 31 '22 09:03 RobbiewOnline