Oops, there were a few problems with that commit, so I fixed them here: https://ubiquity.mozilla.com/hg/ubiquity-firefox/raw-file/93fd600b03e2/ubiquity/index.html#feed-parts/header/cmdutils.js
- Atul On 2/16/09 1:05 PM, Atul Varma wrote: > Ack! Sorry for the inconvenience there... That kind of functionality > has actually always been present in Ubiquity, but it wasn't > documented! I've added some documentation just now: > > https://ubiquity.mozilla.com/hg/ubiquity-firefox/raw-file/08f1e8bbfd67/ubiquity/index.html#feed-parts/header/cmdutils.js > > Just search for the word 'previewDelay'. Basically, you can pass in > an optional argument to CmdUtils.CreateCommand() that tells it how > long a user should've stopped typing for before the preview function > is called. > > Thanks for mentioning this! > > - Atul > > On 2/16/09 12:12 PM, gtdphp developers wrote: >>> 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 -~----------~----~----~----~------~----~------~--~---
