Well that works so far in that the presence of an uncaught Exception
indicates the bookmark doesn't exist.

However there is still an uncaught exception. If this is the best way
to use the API then clearly the API is rubbish.

Wouldn't it be better if an array of BookmarkTreeNodes was passed to
the callback function, like this: function(array of BookmarkTreeNode
results) {...});

If there are no results, then the array is empty.

(This is how chrome.bookmarks.search works)

thoughts?



On Dec 30, 1:17 pm, Daniel Wagner-Hall <dawag...@gmail.com> wrote:
> Are you looking for a specific bookmark by ID? Something along the lines of:
>
> chrome.bookmarks.get(folderID, function(foo) { if
> (chrome.extension.lastError) { console.log("Not found"); } else {
> console.log("Found"); }});
>
> may work...
>
>
>
> On Wed, Dec 30, 2009 at 1:08 AM, rich <atkins...@gmail.com> wrote:
> > bump!
>
> > On Dec 29, 6:54 am, rich <atkins...@gmail.com> wrote:
> >> What is the recommended way to test for existence of a
> >> BookmarkTreeNode that doesn't have a URL (i.e. a folder)?
>
> >> chrome.bookmarks.search does not work for non-URL bookmarks (always
> >> returns false)
>
> >> The following code is fugly, and doesn't work:
>
> >> try {
> >>         chrome.bookmarks.get(folderID, function(){console.log('found')});} 
> >> catch(e) {
>
> >>         console.log('not found');
>
> >> }
>
> >> So, what is the recommended way to test for existence of a
> >> BookmarkTreeNode that doesn't have a URL (i.e. a folder)?
>
> >> - rich
>
> > --
>
> > You received this message because you are subscribed to the Google Groups 
> > "Chromium-extensions" group.
> > To post to this group, send email to chromium-extensi...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > chromium-extensions+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/chromium-extensions?hl=en.

--

You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to chromium-extensi...@googlegroups.com.
To unsubscribe from this group, send email to 
chromium-extensions+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en.


Reply via email to