Skip to content

Instantly share code, notes, and snippets.

@satyr
Created April 10, 2009 20:56
Show Gist options
  • Save satyr/93291 to your computer and use it in GitHub Desktop.
Save satyr/93291 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand({
name: 'test',
takes: {$: {_name: '$', suggest: function(txt, htm, cb){
for(var i = 1; i <= 4; ++i)
(function(x) Utils.setTimeout(function(){
cb(CmdUtils.makeSugg('async-'+ x));
}, x * 333))(i);
return [CmdUtils.makeSugg(txt)];
}}},
preview: function(pbl, {text}){
var out = uneval(text) +' is previewd '+ ++/static/.lastIndex +' times';
displayMessage(out);
CmdUtils.log(out);
pbl.textContent = out;
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment