Merge pull request #201 from soraphis/canary-200-fix

#200 UnregisterAll did not unregister for listeners of OnEventNoValue (#201)
This commit is contained in:
Miika Lönnqvist 2020-10-11 16:06:08 +02:00 committed by GitHub
commit 831312f4a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -26,7 +26,7 @@ namespace UnityAtoms
protected event Action<T> _onEvent;
/// <summary>
/// The event replays the specified number of old values to new subscribers. Works like a ReplaySubject in Rx.
/// The event replays the specified number of old values to new subscribers. Works like a ReplaySubject in Rx.
/// </summary>
[SerializeField]
[Range(0, 10)]
@ -97,8 +97,9 @@ namespace UnityAtoms
/// <summary>
/// Unregister all handlers that were registered using the `Register` method.
/// </summary>
public void UnregisterAll()
public override void UnregisterAll()
{
base.UnregisterAll();
_onEvent = null;
}

View File

@ -42,6 +42,14 @@ namespace UnityAtoms
OnEventNoValue -= del;
}
/// <summary>
/// Unregister all handlers that were registered using the `Register` method.
/// </summary>
public virtual void UnregisterAll()
{
OnEventNoValue = null;
}
/// <summary>
/// Register a Listener that in turn trigger all its associated handlers when the Event triggers.
/// </summary>
@ -75,4 +83,4 @@ namespace UnityAtoms
}
}
}
}