Skip to content

Commit

Permalink
2 files modified, 1 added
Browse files Browse the repository at this point in the history
  • Loading branch information
CatzillaOrz committed Jul 8, 2022
1 parent 866512a commit ebfdc5d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
17 changes: 17 additions & 0 deletions 16-operator_debounceTime.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { fromEvent } from 'rxjs';
import { debounceTime } from 'rxjs/operators';

export class OperatorDebounceTime {
create() {
const sliderInput = document.getElementById('customRange1');
fromEvent(sliderInput, 'input')
.pipe(debounceTime(2000))
.subscribe((observeer: any) => {
console.log(observeer.target.value);
});
}

run() {
this.create();
}
}
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
border-solid border-2 border-sky-500
"
>
<div class="card">
<div class="card-body text-sky-400">
<label for="customRange1" class="form-label">Debounce range</label>
<input type="range" class="form-range" id="customRange1">
</div>
<div class="card">
<div class="card-body">
<input
Expand Down
5 changes: 4 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { CreationFunctionCombineLatest } from './12-creation_fun_combineLatest';
import { OperatorFilter } from './13-operator-filter';
import { OperatorMap } from './14-operator-map';
import { OperatorTap } from './15-operator-tap';
import { OperatorDebounceTime } from './16-operator_debounceTime';

// runMyFun(RxjsUnsubscribe);

Expand All @@ -39,4 +40,6 @@ import { OperatorTap } from './15-operator-tap';

// runMyFun(OperatorMap);

runMyFun(OperatorTap);
// runMyFun(OperatorTap);

runMyFun(OperatorDebounceTime);

0 comments on commit ebfdc5d

Please sign in to comment.