mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 03:42:37 +02:00
fix: add throttle in autocomplete
This commit is contained in:
parent
2d1c4ad3c0
commit
abbd0eef62
1 changed files with 5 additions and 1 deletions
|
@ -16,6 +16,7 @@ export class BaseAutocomplete {
|
||||||
allowFree: true,
|
allowFree: true,
|
||||||
minChar: 2,
|
minChar: 2,
|
||||||
maxResults: 5,
|
maxResults: 5,
|
||||||
|
throttling: 300,
|
||||||
}
|
}
|
||||||
this.cache = ''
|
this.cache = ''
|
||||||
this.results = []
|
this.results = []
|
||||||
|
@ -125,7 +126,10 @@ export class BaseAutocomplete {
|
||||||
'Control',
|
'Control',
|
||||||
]
|
]
|
||||||
if (!special.includes(e.key)) {
|
if (!special.includes(e.key)) {
|
||||||
this.search()
|
if (this._typing) window.clearTimeout(this._typing)
|
||||||
|
this._typing = window.setTimeout(() => {
|
||||||
|
this.search()
|
||||||
|
}, this.options.throttling)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue