1
0
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:
Davide Iadeluca
2025-02-10 07:45:15 +01:00
committed by GitHub
parent 45cb384241
commit 991a243c9d

View File

@@ -59,6 +59,11 @@ export default class Search<T extends SearchAttrs = SearchAttrs> extends Compone
*/
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.
*/
@@ -258,7 +263,7 @@ export default class Search<T extends SearchAttrs = SearchAttrs> extends Compone
state.cache(query);
m.redraw();
}, 250);
}, (search.constructor as typeof Search).SEARCH_DEBOUNCE_TIME_MS);
})
.on('focus', function () {