public StringKeyValueModelState(IServiceProvider services) : base( new Options() { UpdateDelayer = new UpdateDelayer(0.5) }, services) { Locals = new MutableState <string>(services); Locals.AddEventHandler(StateEventKind.Updated, (_, _) => this.Recompute()); }
public StringKeyValueModelState(IServiceProvider services) : base( new Options() { UpdateDelayer = new UpdateDelayer(services.UICommandTracker(), 0.5) }, services) { Locals = services.StateFactory().NewMutable(""); Locals.AddEventHandler(StateEventKind.Updated, (_, _) => this.Recompute()); }
public ClientState(AuthStateProvider authStateProvider, IStateFactory stateFactory) { AuthStateProvider = authStateProvider; SessionResolver = AuthStateProvider.SessionResolver; User = stateFactory.NewLive <User>( o => o.WithUpdateDelayer(0, 1), async(_, cancellationToken) => { var authState = await AuthState.UseAsync(cancellationToken).ConfigureAwait(false); return(authState.User); }); ChatUser = stateFactory.NewMutable(Result.Value <ChatUser?>(null)); }
public StringKeyValueModelState(Options options, IServiceProvider serviceProvider, object?argument = null) : base(options, serviceProvider, argument) { Locals = new MutableState <string>(serviceProvider); Locals.AddEventHandler(StateEventKind.Updated, (s, e) => this.CancelUpdateDelay()); }
public CounterService(IMutableState <int> offset) => _offset = offset;