Skip to content

Commit 8b16e07

Browse files
committed
Added throttle for checkCursorMenu, gain much better input performance
1 parent fae3c02 commit 8b16e07

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

public/js/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ var defaultExtraKeys = {
5252

5353
var idleTime = 300000; //5 mins
5454
var updateViewDebounce = 200;
55+
var cursorMenuThrottle = 100;
5556
var cursorActivityDebounce = 50;
5657
var cursorAnimatePeriod = 100;
5758
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) {
23402341

23412342
var upSideDown = false;
23422343

2343-
function checkCursorMenu() {
2344+
var checkCursorMenu = _.throttle(checkCursorMenuInner, cursorMenuThrottle);
2345+
2346+
function checkCursorMenuInner() {
23442347
var menuMargin = 60;
23452348
var dropdown = $('.cursor-menu .dropdown-menu');
23462349
if (dropdown.length <= 0) return;

0 commit comments

Comments
 (0)