Skip to content
This repository has been archived by the owner on Jun 22, 2022. It is now read-only.

Commit

Permalink
Dont search ascii 1 char keyword for perf
Browse files Browse the repository at this point in the history
  • Loading branch information
muan committed Jan 29, 2016
1 parent 7156ba2 commit ae9bc86
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions app/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var directions = {
searchInput.focus()
search('')
searchInput.addEventListener('input', function (evt) {
search(this.value)
if (this.value.length > 1 || this.value.charCodeAt() > 255) search(this.value)
})

document.addEventListener('mousewheel', function (e) {
Expand Down Expand Up @@ -107,7 +107,6 @@ function search (query) {
function buildIndex () {
var keywords = {}
emojikeys.forEach(function (name) {
console.log(name)
var words = emojilib[name]['keywords']
words.push(name)
words.push(emojilib[name]['char'])
Expand Down

2 comments on commit ae9bc86

@paulirish
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This introduces some weirdness when you type something and hit backspace to return to ''
In that case we'd want the same search('') behavior, I think

@muan
Copy link
Owner Author

@muan muan commented on ae9bc86 Jan 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paulirish Good point, I added 6c45a0a to address this. Thanks! 🙇

Please sign in to comment.