using System; using JetBrains.Annotations; using JetBrains.Core; using JetBrains.Lifetimes; namespace JetBrains.Collections.Viewable; public interface IAsyncSource { void AdviseOn(Lifetime lifetime, IScheduler scheduler, Action action); } class AsyncSignal : IAsyncSource { private readonly ISignal mySignal = new Signal(); public void AdviseOn(Lifetime lifetime, IScheduler scheduler, Action action) { mySignal.Advise(lifetime, value => { scheduler.Queue(() => action(value)); }); } public void Fire(T value) => mySignal.Fire(value); } public interface IReadonlyAsyncProperty : IAsyncSource { IAsyncSource Change { [NotNull] get; } Maybe Maybe { [NotNull] get; } T Value { get; } } public interface IAsyncProperty : IReadonlyAsyncProperty { new T Value { get; set; } }