@@ -48,6 +48,10 @@ define([
48
48
} ;
49
49
50
50
return Component . extend ( {
51
+ DEFAULT_HITS_PER_SECTION ,
52
+ DEBOUNCE_MS ,
53
+ MIN_SEARCH_LENGTH_CHARS ,
54
+
51
55
initialize ( config , element ) {
52
56
// console.log('AC initialized with', config, element);
53
57
this . buildAutocomplete ( $ ) ;
@@ -99,7 +103,7 @@ define([
99
103
} ,
100
104
101
105
buildAutocompleteOptions ( searchClient , sources , plugins ) {
102
- const debounced = this . debounce ( items => Promise . resolve ( items ) , DEBOUNCE_MS ) ;
106
+ const debounced = this . debounce ( items => Promise . resolve ( items ) , this . DEBOUNCE_MS ) ;
103
107
104
108
let options = algoliaCommon . triggerHooks ( 'beforeAutocompleteOptions' , { } ) ;
105
109
@@ -123,7 +127,7 @@ define([
123
127
return this . filterMinChars ( query , debounced ( this . transformSources ( searchClient , sources ) ) ) ;
124
128
} ,
125
129
shouldPanelOpen : ( { state} ) => {
126
- return state . query . length >= MIN_SEARCH_LENGTH_CHARS ;
130
+ return state . query . length >= this . MIN_SEARCH_LENGTH_CHARS ;
127
131
} ,
128
132
// Set debug to true, to be able to remove keyboard and be able to scroll in autocomplete menu
129
133
debug : algoliaCommon . isMobile ( ) ,
@@ -265,7 +269,7 @@ define([
265
269
*/
266
270
buildAutocompleteSourceDefault ( section ) {
267
271
const options = {
268
- hitsPerPage : section . hitsPerPage || DEFAULT_HITS_PER_SECTION ,
272
+ hitsPerPage : section . hitsPerPage || this . DEFAULT_HITS_PER_SECTION ,
269
273
analyticsTags : 'autocomplete' ,
270
274
clickAnalytics : true ,
271
275
distinct : true ,
0 commit comments