Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added debounce for typeahead search optimization #4904

Merged
merged 25 commits into from
Mar 9, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
bdc9497
Added debounce for typeahead search optimization
aashna27 Mar 3, 2019
d806740
Update README.md (#4883)
Aneal-Sharma Mar 3, 2019
c8bfed1
convert chars to unicode (#4901)
grvsachdeva Mar 4, 2019
82beb3f
fixes for map module (#4909)
jywarren Mar 4, 2019
25213e8
updated yarn.lock (#4911)
jywarren Mar 4, 2019
d19cfcf
Remove useless variable assignment (#4885)
siaw23-retired Mar 4, 2019
b144b9e
Made moderate buttons to appear on the same line (#4913)
manansingh96 Mar 5, 2019
40b6624
Clean up (#4902)
siaw23-retired Mar 5, 2019
95509de
Follow tag asynchronously (#4587)
shubhscoder Mar 5, 2019
578cae8
Move verification link (#4786)
shubhscoder Mar 5, 2019
27b9ecf
popover works, styling is still not showing under elements but is und…
Chrisyee22 Mar 5, 2019
bb9216b
First timer tag script (#4878)
cesswairimu Mar 5, 2019
960dba0
Consolidating ranges and stats (#4887)
cesswairimu Mar 5, 2019
3013ddf
move tag graph button (#4921)
jywarren Mar 5, 2019
ba6f3b8
Added reply by tweet feature (#3175)
namangupta01 Mar 5, 2019
984066a
Add more relevant search results (#4848)
shubhscoder Mar 6, 2019
1a9f19c
chore: update README.md (#4926)
saumyag33 Mar 6, 2019
33380fb
Bump cytoscape from 3.4.2 to 3.5.0 (#4929)
dependabot[bot] Mar 6, 2019
1493568
Tiny fix (#4933)
siaw23-retired Mar 6, 2019
1737876
Update 20190301075323_add_first_tag_poster.rb
jywarren Mar 7, 2019
6396287
updates (#4851)
arungoel123456 Mar 7, 2019
5469e0d
fix for wiki update (#4942)
grvsachdeva Mar 7, 2019
ab7140f
Merge branch 'typeahead-completion' of git://github.com/aashna27/plot…
jywarren Mar 8, 2019
1562288
fixes, extend to title suggestions
jywarren Mar 9, 2019
df67ed8
extended to atwho
jywarren Mar 9, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ env:
jquery: true
node: true

parseOptions:
sourceType: module

# http://eslint.org/docs/rules/
rules:
# Possible Errors
Expand Down
18 changes: 18 additions & 0 deletions app/assets/javascripts/debounce.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
export function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
};
6 changes: 3 additions & 3 deletions app/assets/javascripts/restful_typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
search API and the UI components.
Documentation here: https://github.com/bassjobsen/Bootstrap-3-Typeahead
**/
import { debounce } from './debounce.js';

$(function() {
$('input.search-query.typeahead').each(function(i, el){
$('input.search-query.typeahead').each(debounce(function(i, el){
var typeahead = $(el).typeahead({
items: 10,
minLength: 3,
delay: 350,
showCategoryHeader: true,
autoSelect: false,
source: function (query, process) {
Expand Down Expand Up @@ -46,5 +46,5 @@ $(function() {
showAll: true
}
});
});
}, 350));
});