Oh!
Thanks....
Sorry did not know about chromium-extensions.
Hello All,
I have the following problem:
>> >> I have two extensions, one that needs to use the other B uses A.
>> >>
>> >> How do I make sure that that A is loaded before B?
>> >>
>> >> Should background page of B just loop and wait and retry connection?
I also made some solution described bellow.
Anyone has a better solution?
Regards,
Alon Bar-Lev.
On Sun, May 13, 2012 at 7:29 PM, PhistucK <
phis...@gmail.com> wrote:
> That is a good way to tell, because background pages are supposed to load
> (or at least start loading) before all of the tabs start to load.
> I am not sure about the efficiency of such approach, but it seems fine to me
> barring other ideas.
>
> Oh and this discussion should really move to chromium-extensions.
>
> ☆PhistucK
>
>
>
> On Sun, May 13, 2012 at 3:28 PM, Alon Bar-Lev <
alon....@gmail.com> wrote:
>>
>> Thank you for your response!
>>
>> Well, I don't want to add extra privilege to the extension...
>> And there is no proper timer for background pages[1].
>>
>> So I done the following monitoring tab update at start:
>> ---
>> function ExtWait(extId, maxWait, callback) {
>> this._extId = extId;
>> this._maxWait = maxWait;
>> this._callback = callback;
>> this._loadTime = new Date();
>> this._issued = false;
>> this._tabs_onUpdated_bound = this._tabs_onUpdated.bind(this);
>> chrome.tabs.onUpdated.addListener(this._tabs_onUpdated_bound);
>> }
>>
>> ExtWait.prototype = {
>> _tabs_onUpdated: function(tabId, changeInfo, tab) {
>> var me = this;
>> chrome.extension.sendRequest(
>> this._extId,
>> {action: "ping"},
>> function(response) {
>> if (response) {
>>
>> chrome.tabs.onUpdated.removeListener(me._tabs_onUpdated_bound)
>> if (!this._issued) {
>> this._issued = true;
>> me._callback();
>> }
>> }
>> else {
>> if ((new Date()).getTime() -
>> me._loadTime.getTime() > me._maxWait) {
>>
>> chrome.tabs.onUpdated.removeListener(me._tabs_onUpdated_bound)
>> }
>> }
>> }
>> );
>> }
>> };
>> ---
>>
>> [1]
http://code.google.com/p/chromium/issues/detail?id=81758
>>
>> On Sun, May 13, 2012 at 12:56 PM, PhistucK <
phis...@gmail.com> wrote:
>> > I think you will have to resort to the retry loop approach, but, first,
>> > you
>> > should know whether the extension is actually installed, I guess, for
>> > which
>> > you can use the management extension API.
>> >
>> > ☆PhistucK
>> >
>> >
>> >
>> > On Sun, May 13, 2012 at 12:03 PM, Alon Bar-Lev <
alon....@gmail.com>
>> > wrote:
>> >>
>> >> Hello,
>> >>
>> >> I could not find answer to this anywhere...
>> >>
>> >> I have two extensions, one that needs to use the other B uses A.
>> >>
>> >> How do I make sure that that A is loaded before B?
>> >>
>> >> Should background page of B just loop and wait and retry connection?
>> >>
>> >> Or... I am looking for an event of the browser in which it is safe to
>> >> say that all extensions loaded.
>> >>
>> >> Thanks!
>> >> Alon.
>> >>
>> >> --
>> >> Chromium Developers mailing list:
chromi...@chromium.org
>> >> View archives, change email options, or unsubscribe:
>> >>
http://groups.google.com/a/chromium.org/group/chromium-dev
>> >
>> >
>
>