documentation for all JS files
This commit is contained in:
@@ -1,4 +1,20 @@
|
||||
// Debounce function
|
||||
/**
|
||||
* @fileoverview Manages the conversations list functionality.
|
||||
* This file handles:
|
||||
* - Conversation search with debounced input
|
||||
* - Search form submission
|
||||
* - Clear filter functionality
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a debounced version of a function that delays its execution
|
||||
* until after a specified wait time has elapsed since the last time it was invoked.
|
||||
* This helps prevent excessive form submissions during rapid user input.
|
||||
* @function
|
||||
* @param {Function} func - The function to debounce
|
||||
* @param {number} wait - The number of milliseconds to delay (300ms default for search)
|
||||
* @returns {Function} A debounced version of the provided function
|
||||
*/
|
||||
function debounce(func, wait) {
|
||||
let timeout;
|
||||
return function(...args) {
|
||||
@@ -7,6 +23,13 @@ function debounce(func, wait) {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the conversations list functionality when the DOM is loaded.
|
||||
* Sets up:
|
||||
* - Search input with debounced form submission (300ms delay)
|
||||
* - Clear filter button to reset search and refresh results
|
||||
* @function
|
||||
*/
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const searchInput = document.getElementById('conversationSearchInput');
|
||||
const form = document.getElementById('conversationFilterForm');
|
||||
|
||||
Reference in New Issue
Block a user