aboutsummaryrefslogtreecommitdiff
path: root/public/javascripts/search.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/javascripts/search.js')
-rw-r--r--public/javascripts/search.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/public/javascripts/search.js b/public/javascripts/search.js
index 6d6fc3d..0ee3a11 100644
--- a/public/javascripts/search.js
+++ b/public/javascripts/search.js
@@ -1,11 +1,13 @@
/* global USERS */
+const EventEmitter = require('events')
const fuzzy = require('fuzzy')
const autocomplete = require('./autocomplete')
-const schedule = require('./schedule')
const self = {}
+self.events = new EventEmitter()
+
self._nodes = {
search: document.querySelector('#search'),
input: document.querySelector('input[type="search"]')
@@ -16,10 +18,11 @@ self.submit = function () {
const selectedItem = autocomplete.getSelectedItem()
self._nodes.input.value = selectedItem.value
- schedule.viewItem(0, selectedItem)
autocomplete.removeAllItems()
document.body.classList.add('searched')
+
+ self.events.emit('search', selectedItem)
}
self._handleSubmit = function (event) {