Example #1
0
        public PulseVM(IEnumerable <IPulseDataProvider> dataSources, PulseConfiguration pulseConfig)
        {
            LiveUpdate = AddProperty(nameof(LiveUpdate), true)
                         .WithAttribute(new CheckboxAttribute()
            {
                Label = "Live update"
            });

            var onPushUpdates = ConfigureDataSource(dataSources);

            // Set minimum interval to push updates.
            Observable
            .Interval(TimeSpan.FromMilliseconds(pulseConfig.PushUpdateInterval))
            .Subscribe(_ =>
            {
                onPushUpdates.ForEach(x => x(LiveUpdate));
                if (LiveUpdate)
                {
                    PushUpdates();
                }
            })
            .AddTo(_disposables);
        }
Example #2
0
 public PulseMiddleware(RequestDelegate next, PulseConfiguration config)
 {
     _next   = next;
     _config = config;
 }