Hi Andrey, As you observe, the Event dispatch function is not a part of the public API, so it cannot be depending upon (future implementation may change it's behavior).
Can you explain your use case? Why are you trying to simulate a click to the browserAction? As to your second question (why do you have to call the background pages event.dispatch), the reason is that each page has it's own copy of that event object, with it's own set of listeners. The event.dispatch() as receiver of event data from the browser, not a sender. It merely routes the event information to the listeners in that context. There is no way to "fire" events from javascript such that their behavior would mimic the behavior as if the event had been generated "organically" from the browser. Hope this helps. Cheers Rafael On Mon, Jan 18, 2010 at 4:49 AM, Andrey <aand...@google.com> wrote: > Hi Team, > Can I use the following code to simulate a browser action click: > > chrome.tabs.getSelected(null, function(tab) { > var backgroundPage = chrome.extension.getBackgroundPage(); > backgroundPage.chrome.browserAction.onClicked.dispatch(tab); > }); > > This code does work, but AFAIU, the > chrome.browserAction.onClicked.dispatch() is NOT a documented API, is > it? But still I'll ask, can I rely on it? :) > > And, as a side note: notice that I have to use the backgroundPage's > chrome object to do the trick when the code is being run inside a > browserAction's popup page. Bother to explain why the direct > chrome.browserAction.onClicked.dispatch() would not work? :) > > Thanks. > > -- > 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. > > > >
-- 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.