On Nov 30, 6:50 pm, Myk Melez <
m...@mozilla.org> wrote:
> 1. jetpack.places.bookmark() feels like something that would make more
> sense hanging off the active tab accessor (i.e. something like
> tabs.activeTab.bookmark()), since there's nothing about jetpack.places
> that suggests that its methods would affect the active tab.
>
I agree, we should plan on implementing this in the active tab. (or
all tabs - just add a bookmark method to all of them)
> 2. It's not clear from the JEP where the bookmarks object comes from.
> Does it hang off jetpack.places?
>
No, I will have to re-work the examples - the bookmarks object is
inside the callback function - the bookmarks is the iterator that is
passed into the callback.
> 3. It'd be useful for fetch to permit intersection (OR) searches in
> addition to union (AND) searches. A simple way to enable that would be
> to make the first parameter optionally accept an array of objects
An array of 'search objects' would be a good way to do this. At this
point, using the existing API, this would be difficult and slow to
implement - and is beyond the current APIs capability - at least
without 2 distinct, synchronous searches.
I will plan to implement this in the fully async rewrite.
>
> 4. I really like the simplicity of specifying a callback that gets all
> the results at the end. However, since the asynchronous storage API can
> return results progressively, it's worth thinking a bit about ways we
> might enable callbacks to take advantage of this. Perhaps a callback
> that is an object rather than a function could be considered a
> progressive listener and get regular updates to a long running search?
>
excellent idea, perhaps we can optionally provide a listener 'base
class' that does just that? I think the async implementation (in
MozStorage) will call the callback for each chunk that is fetched.
> 5. The examples say that bookmark.save() is "called to make the title
> change stick". Does it really only affect the title, or does it affect
> the other attributes as well?
It will affect all attributes
>
> 6. bookmark.tags() feels like it wants to be a property (that might be
> implemented internally as a getter) rather than a method. And I'd
> probably want to be able to set tags via bookmark.tags = [...] in
> addition to being able to add a tag via bookmark.tag().
>
I agree. I will update the JEP with getters/setters
> 7. I don't see any mention of accessing history items, but presumably
> their properties are similar to bookmarks (except for the
> bookmarks-specific stuff)? I also don't see any mention of annotations; v2?
>
History is quite similar, you change the 'where' property to 'history'
or 'everywhere' (to comingle history and bookmarks). Annotations will
be added later (asap).
> 8. If there's a jetpack.places.bookmarks, then it'd make sense to hang a
> fetch method off it that works just like jetpack.places.fetch but
> assumes where: "bookmarks".
>
I wasn't planning on it since jetpack.places.bookmarks.fetch gets a
bit verbose, however, that might make logical sense.
> 9. It's not clear what the distinction is between where: "history" and
> where: "everywhere". Aren't bookmarks always also in history? Or does
> where: "history" only return history items that aren't also bookmarked?
>
history will have everything in it (including bookmarks) - you just
won't know that it is a bookmark, nor will you have access to tags and
annotations.
> 10. There are both term and phrase search parameters. What's the
> difference, and which one do you do when you pass fetch a simple string?
'term' was a typo, I wrote this JEP before starting on the places API,
and am trying to make them very similar, using 'phrase' and 'fetch',
for instance.
> 11. Finally, I'll bikeshed a bit and suggest that find seems like a bit
> more intuitive name for fetch! ;-)
Yeah, I agree, I thought that making the 2 APIs use the same method
and properties had some merit. I may be wrong, since the places API is
internal to firefox (and will be used by add-on authors as well), and
the Jetpack API should be as elegant as possible. "find" has a pretty
nice ring to it.
Myk: Thanks for the great feedback.
David