Hi,
I am converting my addon to bootstrap and to my current knowledge, all my code is now inside a sandbox, which cannot be accessed from other addons or the thunderbird UI.
I successfully injected an statusbarpanel to the statusbar of mail:3pane and this has an onclick handler which should call one of my functions, but i get an "is not defined" error.
I overcome this by adding an observer to my code and the onclick sends now a notify to that observer.
I assume this is intended, but is there any way, I can make an object i created avail to the global scope?
How will lightning get around that and expose its cal object? Or am I no longer able to use the cal object in my addon, once lightning gets bootstraped?
Thanks
John
On 4/1/18 9:56 AM, John Bieling via Maildev wrote:
Hi,
I am converting my addon to bootstrap and to my current knowledge, all my code is now inside a sandbox, which cannot be accessed from other addons or the thunderbird UI.
I successfully injected an statusbarpanel to the statusbar of mail:3pane and this has an onclick handler which should call one of my functions, but i get an "is not defined" error.
I overcome this by adding an observer to my code and the onclick sends now a notify to that observer.
I assume this is intended, but is there any way, I can make an object i created avail to the global scope?
How will lightning get around that and expose its cal object? Or am I no longer able to use the cal object in my addon, once lightning gets bootstraped?
Thanks
John
Hi John,
I believe this list is meant more for discussions around technical
future instead of add-ons support, I think
https://groups.google.com/d/forum/mozilla.dev.apps.thunderbird might be
a better place to ask. We do have many channels though and it confuses
myself as well what belongs where, so no worries (and I may even be
wrong in saying that).
I'm not quite clear what you mean with "global scope". Do you mean the
toplevel scope of each Thunderbird window? If so, then what you need to
do is have your bootstrap.js listen for window creation, and inject code
into each window. The window object will have access to global objects,
such as cal.*
You can think of bootstrap.js like a JSM module, it doesn't have access
to windows. You can use ChromeUtils.import to import other modules, but
if you want to inject things into a window you will have to enumerate
the windows and do the inejction there.
This guide sums it up pretty well:
https://flagfox.wordpress.com/2014/01/19/writing-restartless-addons/
Philipp
On 05/04/2018 11:09, Philipp Kewisch wrote:
You can think of bootstrap.js like a JSM module, it doesn't have access
to windows. You can use ChromeUtils.import to import other modules, but
if you want to inject things into a window you will have to enumerate
the windows and do the inejction there.
This guide sums it up pretty well:
https://flagfox.wordpress.com/2014/01/19/writing-restartless-addons/
That page seems to be a variation of
As for "enumeration of windows", I'm sure John has this covered since he
wrote about injecting into the status panel. For the record: The new
bootstrapped "Shrunked Image Resizer" (4.4.5) has a very nice
bootstrap.js or we also have some in the tree:
Jörg.