mirror of
https://github.com/flarum/core.git
synced 2025-08-04 15:37:51 +02:00
refactor: make search debounce time extensible (#4171)
This commit is contained in:
@@ -59,6 +59,11 @@ export default class Search<T extends SearchAttrs = SearchAttrs> extends Compone
|
|||||||
*/
|
*/
|
||||||
protected static MIN_SEARCH_LEN = 3;
|
protected static MIN_SEARCH_LEN = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Time to wait (in milliseconds) after the user stops typing before triggering a search.
|
||||||
|
*/
|
||||||
|
protected static SEARCH_DEBOUNCE_TIME_MS = 250;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The instance of `SearchState` for this component.
|
* The instance of `SearchState` for this component.
|
||||||
*/
|
*/
|
||||||
@@ -258,7 +263,7 @@ export default class Search<T extends SearchAttrs = SearchAttrs> extends Compone
|
|||||||
|
|
||||||
state.cache(query);
|
state.cache(query);
|
||||||
m.redraw();
|
m.redraw();
|
||||||
}, 250);
|
}, (search.constructor as typeof Search).SEARCH_DEBOUNCE_TIME_MS);
|
||||||
})
|
})
|
||||||
|
|
||||||
.on('focus', function () {
|
.on('focus', function () {
|
||||||
|
Reference in New Issue
Block a user