aboutsummaryrefslogtreecommitdiff
path: root/public/javascripts/search.js
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2016-12-09 15:33:05 +0100
committerNoah Loomans <noahloomans@gmail.com>2016-12-09 15:33:05 +0100
commit907e8c138ae890208b03b23a420b32290fc2ef88 (patch)
tree27f9c8ecc0432554e8e648ad438c6d325bac7b6d /public/javascripts/search.js
parente18bf78dd0a0ab8b4a70da6e370faa1a1132e211 (diff)
switch to search fireing search event
instaid of calling schedule.viewItem himself
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) {