Browse Source

Share animation timer.

Previously every new subscription was creating a new timer. Using
Publish().RefCount() makes all subscriptions share the same one.
pull/39/head
Steven Kirk 12 years ago
parent
commit
18ca92eccd
  1. 5
      Perspex.Animation/Animate.cs

5
Perspex.Animation/Animate.cs

@ -34,7 +34,10 @@ namespace Perspex.Animation
{
Stopwatch = new Stopwatch();
Stopwatch.Start();
Timer = Observable.Interval(Tick, PerspexScheduler.Instance).Select(_ => Stopwatch.Elapsed);
Timer = Observable.Interval(Tick, PerspexScheduler.Instance)
.Select(_ => Stopwatch.Elapsed)
.Publish()
.RefCount();
}
/// <summary>

Loading…
Cancel
Save