Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@springernature/global-autocomplete
Advanced tools
Basic autocomplete function that listens to key events on a text input and fetches suggestions from a specified endpoint.
import autoComplete from 'global-autocomplete';
const onResults = data => {
// Update UI with results returned from server, e.g.
const resultsContainer = document.createElement('div');
resultsContainer.className = 'c-results-container';
data.forEach(datum => {
const result = document.createElement('div');
result.textContent = datum;
result.tabIndex = "0"; // So you can focus/tab through the results
result.className = 'c-results-container__result';
resultsContainer.appendChild(result);
});
document.querySelector('[data-component-autocomplete]').insertAdjacentElement('afterend', resultsContainer);
};
const onSelect = result => {
// Update UI with selected result
}
const onError = error => {
// Update UI with error state
// Optionally call myAutoComplete.disable();
}
const args = {
selector: '[data-component-autocomplete]',
onSelect: onSelect,
searchError: onError,
endPoint: 'autocomplete?q=',
timeout: 2000, // OPTIONAL: Set a timeout for the fetch request, onError will be called if fetch request timeouts, default is 2000
minCars: 1, // OPTIONAL: Minimum characters to be typed before request is sent, default is 0
inputDelay: 300, // OPTIONAL: Delay between keypress and request being sent, default is 300
headers: {
Accept: 'application/json; version=2'
},
resultsContainerSelector: 'c-results-container',
resultSelector: 'c-results-container__result',
resultsCallBack: onResults
};
const myAutoComplete = autoComplete(args);
myAutoComplete.enable();
FAQs
Autocomplete/suggest component
The npm package @springernature/global-autocomplete receives a total of 1,833 weekly downloads. As such, @springernature/global-autocomplete popularity was classified as popular.
We found that @springernature/global-autocomplete demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 14 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.