> What I suggest to track the moment when user stops typing and then call the
> <noun>.suggest I think it would make a lot sense.
I've been wrapping my async-noun suggestions in timeouts, to prevent
rapid-fire repeat calls, as follows 3 seconds delay before a call with
a blank prompt, and 500ms between calls otherwise. Perhaps something
like this could go into CmdUtils:
preview: function gtdlist_preview(aPblock, aNeedle) {
if (this._ajaxTimer) { Utils.clearTimeout(this._ajaxTimer); }
if (this.xhr) {
this.xhr.abort();
this.xhr = false;
}
if (aPblock == null) { return; }
var prompt, timer,
that = this,
filter = this._filter(aNeedle);
if (aNeedle.text === "") {
prompt = "Searching for all live next actions (enter more text
to narrow down the search)";
timer = 3000; // allow 3000ms (=3s) before AJAX call if there's
no prompt string
}
else {
prompt = "Searching for <i>" + aNeedle.text + "</i> ...";
timer = 500; // 500ms should be long enough between key presses
to lag JSON call reasonably, without undue delays or redundant calls
}
aPblock.innerHTML = prompt;
this._ajaxTimer = Utils.setTimeout(realAsyncAjaxCall,timer);
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ubiquity-firefox" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ubiquity-firefox?hl=en
-~----------~----~----~----~------~----~------~--~---