I am trying to learn Meteor, so I tried to write a basic location autocomplete.Currently, given a string, it will request suggestions from https://photon.komoot.de/ (amazing free location autocomplete btw) and display them in an ul-li. What is not done yet is keyboard navigation.autocomplete.html<template name=autocomplete>    <input id={{name}} class=autocomplete-input {{className}}        placeholder={{placeholder}} autocomplete=off/>    <ul class=suggestions></ul></template>autocomplete.js(function() {    var inputEl, suggestionsEl, timeout, displayedSuggestions, selectedSuggestion;    var search = function(inputString) {        if (timeout) {            clearTimeout(timeout);        }        timeout = setTimeout(function() {            HTTP.get(https://photon.komoot.de/api/?q= + inputString + &lang= + globalConfig.language, {},                function(error, response) {                    if (error) {                    } else {                        displayedSuggestions = response.data.features;                        display(displayedSuggestions);                    }                });        }, 300);    };    var suggestionString = function (suggestion) {        return suggestion.properties.name + ' (' + suggestion.properties.country + ')';    };    var selectSuggestion = function(elt) {        inputEl.value = elt.innerHTML;        selectedSuggestion = displayedSuggestions[elt['data-index']];        suggestionsEl.style.display = 'none';    };    var display = function(data) {        suggestionsEl.innerHTML = '';        suggestionsEl.style.display = 'block';        for (var i = 0; i < data.length; i++) {            var suggestion = data[i];            var li = document.createElement('li');            li.className = suggestion;            li.onclick = function() {selectSuggestion(this);};            li['data-index'] = i;            li.innerHTML = suggestionString(suggestion);            suggestionsEl.appendChild(li);        }    };    Template.autocomplete.onRendered( function(){        inputEl = this.find('.autocomplete-input');        suggestionsEl = this.find('.suggestions');    });    Template.autocomplete.events({        keyup .autocomplete-input: function (event) {            search(event.target.value);        }    });})();Two things does not seem very meteor-like. First, I have a lot of local functions, and local variables. Are they supposed to be put somewhere else?Also, I am worried about performance. The keyup event is based on the class of the input. If it is looking through the DOM at each keystroke, it might get slow. I tried using inputEl instead, but this does not seem possible (or is it?).
My first Meteor autocomplete
javascript;meteor;autocomplete