Re: [jetpack] more on notifcationbox

39 views
Skip to first unread message

ZER0

unread,
Oct 18, 2012, 8:30:48 PM10/18/12
to mozilla-la...@googlegroups.com, Ben Campbell
On 10/19/12 1:32 AM, Ben Campbell wrote:

> So: given an addon-sdk Tab object, I need to do something like:
> 1) get the underlying browser element for this tab
> 2) get the underlying tabbrowser window the tab is on
> 3) call tabbrowser.getNotificationBox(browser)
> then I can append a notification.

So, this is something I really want to have in SDK for Firefox, because
we already have it for Fennec: the capability to get the XUL Tab from
the SDK Tab. It useful in a lot of context as soon as you're starting to
do something more complex in SDK with tabs.

> It works, but it's a bit nasty, and I don't want to have to rely on a
> hacked version of the SDK.

I filled a bug:

<https://bugzilla.mozilla.org/show_bug.cgi?id=803375>

I don't expect to have big issues here for implement it, but tabs are
always tricky, so let's see.

> Anyway, hope this is all useful to someone,
> Ben.

Thanks for your report!

Jeff Griffiths

unread,
Oct 19, 2012, 3:56:04 PM10/19/12
to mozilla-la...@googlegroups.com, Ben Campbell
On 12-10-18 4:32 PM, Ben Campbell wrote:
...
> The best starting point I've found so far is this module from Canuckistani:
> https://github.com/canuckistani/jp-notificationbox
>
> example usage:
> var nb = require('notificationbox/notificationbox');
> nb.notify("Hello!", null, 10000); // display for 10 secs
>
> This works great. However, it always adds the notification to the
> currently-active tab (internally, it uses window-utils
> activeBrowserWindow to access the underlying tabbrowser).
> This isn't any good for my purposes - I want to tie the notification to
> a specific tab, which might not be the active one.

I had not considered that use-case ( the module is *very* simple and
mostly based on Copy ShortUrl ).

As Matteo pointed out, we don't currently provide access to the
lower-level implementation from our higher-level abstractions, but this
is yet another case where it would be convenient to do so.

Jeff
Reply all
Reply to author
Forward
0 new messages