Created
June 3, 2021 16:09
-
-
Save neuecc/845bd3da885546c200ddacebeb37883d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// don't send same value(Rx's DistinctUntilChanged) by Filter | |
public class ChangedValueFilter<T> : MessageHandlerFilter<T> | |
{ | |
T lastValue; | |
| |
public override void Handle(T message, Action<T> next) | |
{ | |
if (EqualityComparer<T>.Default.Equals(message, lastValue)) | |
{ | |
return; | |
} | |
| |
lastValue = message; | |
next(message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment