refactor: remove debounce on dice calculations #210
1 changed files with 8 additions and 16 deletions
|
@ -1,15 +1,9 @@
|
||||||
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,
|
|
||||||
FormControl,
|
|
||||||
FormGroup,
|
|
||||||
ReactiveFormsModule,
|
|
||||||
Validators,
|
|
||||||
} from '@angular/forms';
|
|
||||||
import {DiceService} from './dice.service';
|
import {DiceService} from './dice.service';
|
||||||
import {DiceDto, DiceResult} from './dice.model';
|
import {DiceDto, DiceResult} from './dice.model';
|
||||||
import { debounceTime, tap } from 'rxjs/operators';
|
import {tap} from 'rxjs/operators';
|
||||||
import {UserService} from '@service/user.service';
|
import {UserService} from '@service/user.service';
|
||||||
|
|
||||||
type DiceFormGroup = FormGroup<{
|
type DiceFormGroup = FormGroup<{
|
||||||
|
@ -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();
|
||||||
|
|
Reference in a new issue