mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +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,
|
||||
minChar: 2,
|
||||
maxResults: 5,
|
||||
throttling: 300,
|
||||
}
|
||||
this.cache = ''
|
||||
this.results = []
|
||||
|
@ -125,7 +126,10 @@ export class BaseAutocomplete {
|
|||
'Control',
|
||||
]
|
||||
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