Regarding Mozillas Auto-Suggest Extension Tutorial I'd like to design my own auto-suggest extension. The tutorial uses json defined in the autocompletesearchparam
param as suggestion-source.
How would I defi开发者_高级运维ne another source, like a library method from a chrome-content js-file that returns an object?
Just grab that object and serialize it, using something like JSON.stringify()
(assuming its in the format that the extension wants, if not, you'll need to manipulate your object). Now attach your result string to the the "autocompletesearchparam" attribute or "searchParam" property of your element. Should be as simple as that.
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/JSON/stringify
精彩评论