Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Figuring out button or key command that activated add-on code

11 views
Skip to first unread message

Jonathan Kamens

unread,
Jun 4, 2012, 12:39:24 PM6/4/12
to
My Thunderbird add-on has some code tied to the
compose-send-message event, which is fired off from within
Thunderbird's core GenericSendMessage function when a message
is about to be delivered.

I need to figure out in my code specifically how sending the
message was triggered, e.g., Ctrl-Enter, Ctrl-Shift-Enter,
"Send" button, "Send Later" button, etc.

I would rather not replace the code for all of these built-in
triggers with custom code that sticks some state somewhere to
tell me what the trigger was. I'm hoping there's some other
way to do it.

One possibility I thought of is to wonder whether there is
some way to gain access to a list of currently "active"
events, such that I could look in that list to see what kind
of event was the trigger for the currently running JavaScript
code.

Any suggestions?

Thanks,

jik

white...@fastmail.us

unread,
Jun 4, 2012, 2:19:22 PM6/4/12
to Jonathan Kamens
Anything in the event object passed to your handler?

white...@fastmail.us

unread,
Jun 4, 2012, 2:43:50 PM6/4/12
to
white...@fastmail.us wrote:

> Anything in the event object passed to your handler?

In checking the source code where the event is setup and sent
(chrome\messenger\content\messenger\messengercompose\MsgComposeCommands.js),
I don't see anything added to the event that will help. The event is
setup as a UIEvent
<https://developer.mozilla.org/en/DOM/document.createEvent#Notes> but is
initialized with initEvent before sending rather than initUIEvent
<https://developer.mozilla.org/en/DOM/event.initUIEvent>. But it is not
clear that the info you seek is even available at that point anyhow.
0 new messages