refactor: remove debounce on dice calculations #210

Merged
ptran merged 3 commits from refactor-remove-debounce into main 2025-05-21 09:32:51 +00:00
Showing only changes of commit 54e9ccf426 - Show all commits

View file

@ -1,16 +1,10 @@
import { Component, signal, inject, OnInit } from '@angular/core'; import {Component, inject, OnInit, signal} from '@angular/core';
import { CommonModule } from '@angular/common'; import {CommonModule} from '@angular/common';
import { import {FormBuilder, FormControl, FormGroup, ReactiveFormsModule, Validators,} from '@angular/forms';
FormBuilder, import {DiceService} from './dice.service';
FormControl, import {DiceDto, DiceResult} from './dice.model';
FormGroup, import {tap} from 'rxjs/operators';
ReactiveFormsModule, import {UserService} from '@service/user.service';
Validators,
} from '@angular/forms';
import { DiceService } from './dice.service';
import { DiceDto, DiceResult } from './dice.model';
import { debounceTime, tap } from 'rxjs/operators';
import { UserService } from '@service/user.service';
type DiceFormGroup = FormGroup<{ type DiceFormGroup = FormGroup<{
betAmount: FormControl<number | null>; betAmount: FormControl<number | null>;
@ -41,9 +35,7 @@ export class DiceComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
this.diceForm.valueChanges this.diceForm.valueChanges
.pipe( .pipe(tap(() => this.calculateWinChanceAndPotentialWin()))
tap(() => this.calculateWinChanceAndPotentialWin())
)
.subscribe(); .subscribe();
this.calculateWinChanceAndPotentialWin(); this.calculateWinChanceAndPotentialWin();