Hehe, I was doubtful of it not working. :P Good to hear it works. On Tue, Dec 15, 2009 at 9:15 PM, Tiby312 <kenakior...@gmail.com> wrote:
> Thank you it works. :) Apologies, everyone, for the misinformation. > > On Dec 15, 9:36 pm, Rafael Weinstein <rafa...@chromium.org> wrote: > > I think listening in the background page on the onunload event should > > work. I just added this code to a test extension and I could see both > > counts incrementing every time I shut down and relaunched the browser: > > > > window.onload = function() { > > if (!localStorage.onloadCount) > > localStorage.onloadCount = 1; > > else > > localStorage.onloadCount++; > > > > console.log(localStorage.onloadCount); > > console.log(localStorage.onunloadCount); > > }; > > > > window.onunload = function() { > > if (!localStorage.onunloadCount) > > localStorage.onunloadCount = 1; > > else > > localStorage.onunloadCount++; > > }; > > > > > > > > On Tue, Dec 15, 2009 at 5:58 PM, Tiby312 <kenakior...@gmail.com> wrote: > > > Hmm, but that'd only work if the user closed chrome when it only had > > > one tab left when a user could close chrome when it had any number of > > > tabs open. :( > > > > > I guess I'll just have the code be executed at the close of every tab. > > > > > On Dec 15, 9:01 am, "Luca C." <luca1...@gmail.com> wrote: > > >> Hi, > > > > >> you can try to add an event handler each time a tab is closed and > > >> counting the number of open tabs. When this counter goes lower than 2 > > >> than the Chrome is going to be shut down. > > > > >> I hope it helps! > > > > >> Luca > > > > >> On 15 Dic, 02:43, Tiby312 <kenakior...@gmail.com> wrote: > > > > >> > I gave it a shot and the code seems to run if I close the extension > by > > >> > pressing the disable button of the extension in the extensions page, > > >> > but the code doesn't run if I just close the browser. :( > > > > >> > On Dec 14, 6:23 pm, Marcos Aruj <marcos.a...@gmail.com> wrote: > > > > >> > > What you can try is the adding a listener to the uninit event of > the > > >> > > background script, but I haven't tried it. But may work. > > >> > > ;) > > > > >> > > On Sun, Dec 13, 2009 at 5:22 PM, Tiby312 <kenakior...@gmail.com> > wrote: > > >> > > > Is there an event listener for when chrome is closed? I tried > using > > >> > > > the window close event, but it doesn't work for when you close > the > > >> > > > last window. So how would one get some code to execute at that > moment? > > > > >> > > > -- > > > > >> > > > 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<chromium-extensions%2bunsubscr...@googlegroups.com><chromium-extensions%2Bunsu > bscr...@googlegroups.com> > > >> > > > . > > >> > > > For more options, visit this group at > > >> > > >http://groups.google.com/group/chromium-extensions?hl=en. > > > > >> > > -- > > >> > > Marcos Aruj Alvarez > > >> > > Ingeniero de Software > > >> > > ------------------------------- > > >> > > marcos.a...@gmail.com > > >> > > ----- > > > > > -- > > > > > 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<chromium-extensions%2bunsubscr...@googlegroups.com> > . > > > For more options, visit this group athttp:// > 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<chromium-extensions%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/chromium-extensions?hl=en. > > > -- Marcos Aruj Alvarez Ingeniero de Software ------------------------------- marcos.a...@gmail.com ----- -- 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.