views:

315

answers:

1

Can you get results from chome.bookmark.search without having to display them?

Update (Answer):

Ok. Maybe my problem is more complex. If I want to use the result globally.

 function _search() {
  var query = $("searchBox").value;
  chrome.bookmarks.search(query, function (bmk){
   var id = bmk[0].id;
   chrome.bookmarks.get(id, function (bmk){
    url=bmk[0].url;
   });
   chrome.tabs.getSelected(null, function (tab){
    chrome.tabs.update(tab.id, {url: url});
    window.close();
   });
  });

This way I could use the list to open one of the results simply by calling

chrome.tabs.create({url:url})
A: 

Of course, read the docs:

chrome.bookmarks.search(string query, function callback)

use it this way:

chrome.bookmarks.search(query, function(results) {
   // iterate through results
   // open tabs or whatever
});

Updated: you can obviously copy the "results" into a global var but you can also "process in place".

jldupont
Updated with my answer. Thx alot :)
Guibone
@Guibone: my pleasure. See you around.
jldupont