MCPcopy
hub / github.com/callumalpass/tasknotes / constructor

Method constructor

src/bases/components/SearchBox.ts:27–47  ·  view source on GitHub ↗

* @param container - Parent container element * @param onSearch - Callback function called when search term changes * @param debounceMs - Debounce delay in milliseconds (default: 300)

(
		container: HTMLElement,
		onSearch: (term: string) => void,
		debounceMs = 300
	)

Source from the content-addressed store, hash-verified

25 * @param debounceMs - Debounce delay in milliseconds (default: 300)
26 */
27 constructor(
28 container: HTMLElement,
29 onSearch: (term: string) => void,
30 debounceMs = 300
31 ) {
32 this.container = container;
33 this.onSearch = onSearch;
34 this.debounceMs = debounceMs;
35
36 // Create debounced search handler with destroyed check
37 this.debouncedSearch = debounce(
38 (term: string) => {
39 // Don't execute if component has been destroyed
40 if (!this.destroyed) {
41 this.onSearch(term);
42 }
43 },
44 this.debounceMs,
45 false // trailing debounce
46 );
47 }
48
49 /**
50 * Render the search box UI

Callers

nothing calls this directly

Calls 1

debounceFunction · 0.90

Tested by

no test coverage detected