How to use the rxjs/operators.debounceTime function in rxjs

To help you get started, we’ve selected a few rxjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github project-flogo / flogo-web / libs / plugins / flow-client / src / lib / shared / mapper / mapper.component.ts View on Github external
)
      .subscribe(currentInputNode => {
        this.currentInput = currentInputNode;
      });

    state$
      .pipe(
        selectMappings,
        takeUntil(stop$)
      )
      .subscribe(change => this.mappingsChange.emit(change));

    this.dragOverEditor
      .pipe(
        takeUntil(stop$),
        debounceTime(300),
        map((ev: DragEvent) => ({ x: ev.clientX, y: ev.clientY })),
        distinctUntilChanged((prev, next) => prev.x === next.x && prev.y === next.y)
      )
      .subscribe(position => this.editorService.dragOver(position));

    this.mapperService.state$
      .pipe(
        distinctUntilChanged(),
        takeUntil(stop$),
        first()
      )
      .subscribe((state: MapperState) => {
        const inputsData = state.inputs;
        // open first input by default
        if (inputsData.nodes && inputsData.nodes[0]) {
          this.mapperService.selectInput(inputsData.nodes[0]);
github opf / openproject / frontend / src / app / components / wp-form-group / wp-attribute-group.component.ts View on Github external
ngAfterViewInit() {
    setTimeout(() => this.fixColumns());

    // Listen to resize event and fix column start again
    fromEvent(window, 'resize', { passive: true })
      .pipe(
        this.untilDestroyed(),
        debounceTime(250)
      )
      .subscribe(() => {
        this.fixColumns();
      });
  }
github Alfresco / alfresco-ng2-components / lib / core / search-text / search-text-input.component.ts View on Github external
constructor (
        private userPreferencesService: UserPreferencesService
    ) {
        this.toggleSearch
            .pipe(
                debounceTime(200),
                takeUntil(this.onDestroy$)
            )
            .subscribe(() => {
                if (this.expandable) {
                    this.subscriptAnimationState = this.toggleAnimation();
                    if (this.subscriptAnimationState.value === 'inactive') {
                        this.searchTerm = '';
                        this.reset.emit(true);
                        if ( document.activeElement.id === this.searchInput.nativeElement.id) {
                            this.searchInput.nativeElement.blur();
                        }
                    }
                }
            });
    }
github sourcegraph / sourcegraph / browser / src / libs / options / ServerURLForm.tsx View on Github external
constructor(props: ServerURLFormProps) {
        super(props)

        this.subscriptions.add(
            this.changes.subscribe(value => {
                this.props.onChange(value)
                this.setState({ isUpdating: true })
            })
        )

        const submitAfterInactivity = this.changes.pipe(debounceTime(5000), takeUntil(this.submits))

        this.subscriptions.add(
            merge(this.submits, submitAfterInactivity).subscribe(() => {
                this.props.onSubmit()
                this.setState({ isUpdating: false })
            })
        )
    }
github autowp / autowp / ng2 / src / app / mosts / mosts.component.ts View on Github external
ngOnInit(): void {
    this.routeSub = combineLatest(
      this.route.params.pipe(
        distinctUntilChanged(),
        debounceTime(30)
      ),
      this.mostsService.getMenu(),
      (params, menu) => ({ params, menu })
    )
      .pipe(
        tap(data => {
          this.ratingCatname = data.params.rating_catname;
          this.typeCatname = data.params.type_catname;
          this.yearsCatname = data.params.years_catname;

          this.years = data.menu.years;
          this.ratings = data.menu.ratings;
          this.vehilceTypes = vehicleTypesToList(data.menu.vehilce_types);

          this.defaultTypeCatname = this.vehilceTypes[0].catname;
github rabix / composer / src / app / tool-editor / object-inspector / common-sections / description-section / description.component.ts View on Github external
writeValue(port: CommandOutputParameterModel | CommandInputParameterModel): void {
        this.port = port;

        this.form = this.formBuilder.group({
            label: [{value: this.port.label, disabled: this.readonly}],
            description: [{value: this.port.description, disabled: this.readonly}],
            altPrefix: [{value: this.port.customProps["sbg:altPrefix"], disabled: this.readonly}],
            category: [{value: this.port.customProps["sbg:category"], disabled: this.readonly}],
            toolDefaults: [{value: this.port.customProps["sbg:toolDefaultValue"], disabled: this.readonly}],
            fileTypes: [{value: this.port.fileTypes, disabled: this.readonly}]
        });

        this.form.valueChanges.pipe(
            distinctUntilChanged(),
            debounceTime(300)
        ).subscribeTracked(this, value => {

            if (this.isInputPort()) {
                this.setTextProperty("sbg:altPrefix", value.altPrefix, true);
                this.setTextProperty("sbg:category", value.category, true);
                if (!this.isFileType()) {
                    this.setTextProperty("sbg:toolDefaultValue", value.toolDefaults, true);
                }
            }

            if (value.fileTypes) {
                this.setFileTypes(value.fileTypes);
            }

            this.setTextProperty("label", value.label);
            this.setTextProperty("description", value.description);
github UXAspects / UXAspects / docs / app / pages / components / components-sections / scrollbar / infinite-scroll / infinite-scroll.component.ts View on Github external
import { IPlaygroundProvider } from '../../../../../interfaces/IPlaygroundProvider';

const chance = new Chance();

const DEPARTMENTS = ['Finance', 'Operations', 'Investor Relations', 'Technical', 'Auditing', 'Labs'];

@Component({
    selector: 'uxd-components-infinite-scroll',
    templateUrl: 'infinite-scroll.component.html',
    styleUrls: ['./infinite-scroll.component.less']
})
@DocumentationSectionComponent('ComponentsInfiniteScrollComponent')
export class ComponentsInfiniteScrollComponent extends BaseDocumentationSection implements IPlaygroundProvider {

    filterText = new BehaviorSubject('');
    debouncedFilterText = this.filterText.pipe(debounceTime(500));
    allEmployees: any[] = [];
    loadedEmployees: any[] = [];
    loadCallback = this.load.bind(this);
    loadOnScroll = true;
    loading = false;
    pageSize = 20;
    totalItems = 111;

    load(pageNum: number, pageSize: number, filter: any): Promise {
        this._liveAnnouncer.announce('Loading more items at the end of the list, please wait.');
        let promise = new Promise((resolve, reject) => {
            setTimeout(() => {
                const pageStart = pageNum * pageSize;
                const newItems = this.allEmployees
                    .filter(e => this.isFilterMatch(e))
                    .slice(pageStart, pageStart + pageSize);
github Azure / BatchExplorer / app / components / data / shared / cloud-file-picker / cloud-file-picker.component.ts View on Github external
constructor(
        private storageBlobService: StorageBlobService,
        private autoStorageService: AutoStorageService,
        private dialog: DialogService) {

        this._subscriptions.push(this.value.valueChanges.pipe(
            debounceTime(400),
            distinctUntilChanged(),
        ).subscribe((value) => {
            this._checkValid(value);
            if (this._propagateChange) {
                this._propagateChange(value);
            }
        }));
    }
github ORCID / ORCID-Source / orcid-web / src / main / webapp / static / javascript / ng1Orcid / app / modules / works / worksForm.component.ts View on Github external
search = (text$: Observable) =>
    text$.pipe(
      debounceTime(300),
      distinctUntilChanged(),
      map(term => term === '' ? []
        : this.externalIDTypeCache.filter(v => v.name.toLowerCase().indexOf(term.toLowerCase()) > -1).slice(0, 10))
    );
github caos / zitadel / console / src / app / modules / search-user-autocomplete / search-user-autocomplete.component.ts View on Github external
private getFilteredResults(): void {
        this.myControl.valueChanges.pipe(debounceTime(200),
            takeUntil(this.unsubscribed$),
            tap(() => this.isLoading = true),
            switchMap(value => {
                const query = new SearchQuery();

                const unQuery = new UserNameQuery();
                unQuery.setMethod(TextQueryMethod.TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE);
                unQuery.setUserName(value);

                query.setUserNameQuery(unQuery);

                if (this.target === UserTarget.SELF) {
                    return from(this.userService.listUsers(10, 0, [query]));
                } else {
                    return of();
                }