diff options
author | Cheng-Han, Wu | 2016-02-25 13:45:02 +0800 |
---|---|---|
committer | Cheng-Han, Wu | 2016-02-25 13:45:02 +0800 |
commit | 8b16e0723d836a2564eaee029c3e891ef28afb2e (patch) | |
tree | 7edb4cfde6a3bbf6687071eb126bce1f9e4e0d38 /public | |
parent | fae3c02bb2c340a652d726bfdda171788f286580 (diff) |
Added throttle for checkCursorMenu, gain much better input performance
Diffstat (limited to '')
-rw-r--r-- | public/js/index.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/public/js/index.js b/public/js/index.js index a86351f8..ec62f440 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -52,6 +52,7 @@ var defaultExtraKeys = { var idleTime = 300000; //5 mins var updateViewDebounce = 200; +var cursorMenuThrottle = 100; var cursorActivityDebounce = 50; var cursorAnimatePeriod = 100; var supportCodeModes = ['javascript', 'htmlmixed', 'htmlembedded', 'css', 'xml', 'clike', 'clojure', 'ruby', 'python', 'shell', 'php', 'sql', 'coffeescript', 'yaml', 'jade', 'lua', 'cmake', 'nginx', 'perl', 'sass', 'r', 'dockerfile']; @@ -2340,7 +2341,9 @@ if ($('.cursor-menu').length <= 0) { var upSideDown = false; -function checkCursorMenu() { +var checkCursorMenu = _.throttle(checkCursorMenuInner, cursorMenuThrottle); + +function checkCursorMenuInner() { var menuMargin = 60; var dropdown = $('.cursor-menu .dropdown-menu'); if (dropdown.length <= 0) return; |