Skip to content

Instantly share code, notes, and snippets.

@jwChung
Last active November 18, 2015 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwChung/d7500dacbf2b97e9fb50 to your computer and use it in GitHub Desktop.
Save jwChung/d7500dacbf2b97e9fb50 to your computer and use it in GitHub Desktop.
public interface IPageViewTracker
{
IDisposable Track(Page page);
}
public class NamedPageViewTracker : IPageViewTracker
{
public NamedPageViewTracker(
IPageViewTracker innerTacker, IPageViewNameProvider provider)
{
if (innerTacker == null)
throw Error.That.ArgumentNull(nameof(innerTacker));
if (provider == null)
throw Error.That.ArgumentNull(nameof(provider));
InnerTacker = innerTacker;
Provider = provider;
}
public IPageViewTracker InnerTacker { get; }
public IPageViewNameProvider Provider { get; }
public IDisposable Track(Page page)
{
if (Provider.GetPageViewName(page) == null)
return Disposable.Empty;
return InnerTacker.Track(page);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment