1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 07:17:59 +01:00

Speed up JS completion (significantly), but maybe this isnt the best way.

This commit is contained in:
Kris Maglione
2008-10-07 05:37:20 +00:00
parent e33c32fcd6
commit dff300dcbd
2 changed files with 312 additions and 243 deletions

View File

@@ -38,6 +38,8 @@ liberator.util = { //{{{
{
timer.cancel();
this.latest = 0;
/* minInterval is the time between the completion of the command and the next firing. */
this.doneAt = Date.now() + minInterval;
callback(this.arg);
this.doneAt = Date.now() + minInterval;
}
@@ -49,7 +51,7 @@ liberator.util = { //{{{
let now = Date.now();
if (this.doneAt == -1)
timer.cancel();
else if (now >= this.doneAt || this.latest && now >= this.latest)
if (now >= this.doneAt || this.latest && now >= this.latest)
return this.notify();
let timeout = minInterval;
@@ -169,7 +171,7 @@ liberator.util = { //{{{
escapeString: function (str, delimiter)
{
delimiter = delimiter || '"';
return delimiter + str.replace(/([\\'"])/g, "\\$1") + delimiter;
return delimiter + str.replace(/([\\'"])/g, "\\$1").replace("\n", "\\n").replace("\t", "\\t") + delimiter;
},
// Flatten an array: