How execute function in Chrome extension every x seconds.

6,592 views
Skip to first unread message

admi...@gmail.com

unread,
Sep 14, 2011, 9:05:52 AM9/14/11
to Chromium-extensions
Welcome,

I'm trying developing extension for Chrome browser.

I'm need function what will fetch results using XML and in some
cases display notification to user.

I have already done xml, when i'm clicking on my extension all
functions are called properly.

I need some way, to run extension "in background", without clicking
icon.

Is there any way to do this ?

Bellow, i post example, what i will like to get.
That function should be triggered every x seconds, even if extension
is not open.


funcion_run_every_10_seconds()
{
somedata=function_get_xml();
if(somedata =='something')
{
function_what_display_nitification()
}
}



Regards

Boris Smus

unread,
Sep 15, 2011, 1:20:50 AM9/15/11
to admi...@gmail.com, Chromium-extensions
You should set up a poller in the background page using setInterval/setTimeout.

Note that there are some limitations when these calls are made in the background (I think they are clamped to 1s period).

- Boris


--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.


PhistucK

unread,
Sep 15, 2011, 2:15:21 AM9/15/11
to Boris Smus, admi...@gmail.com, Chromium-extensions
In the background - yes - but also in background pages?

PhistucK

admi...@gmail.com

unread,
Sep 16, 2011, 3:40:55 AM9/16/11
to Chromium-extensions
Hello,
That was what i was looking for.
background.html

http://code.google.com/chrome/extensions/background_pages.html

It help me :)

Thank You.

Regards


On Sep 15, 8:15 am, PhistucK <phist...@gmail.com> wrote:
> In the background - yes - but also in background pages?
>
> ☆*PhistucK*
>
> On Thu, Sep 15, 2011 at 08:20, Boris Smus <s...@chromium.org> wrote:
> > You should set up a poller in the background page using
> > setInterval/setTimeout.
>
> > Note that there are some limitations when these calls are made in the
> > background (I think they are clamped to 1s period).
>
> > - Boris
>
> > On Wed, Sep 14, 2011 at 6:35 PM, Admin...@gmail.com <admin...@gmail.com>wrote:
>
> >> Welcome,
>
> >> I'm trying developing extension for Chrome browser.
>
> >> I'm need function what will  fetch results using XML and  in some
> >> cases display notification to user.
>
> >> I have already done xml, when i'm clicking on my extension all
> >> functions are called properly.
>
> >> I need some way, to run extension "in background", without clicking
> >> icon.
>
> >> Is there any way to do this ?
>
> >> Bellow, i post example, what i will like to get.
> >> That function should be triggered every x seconds, even if extension
> >> is not open.
>
> >> funcion_run_every_10_seconds()
> >> {
> >> somedata=function_get_xml();
> >> if(somedata =='something')
> >> {
> >> function_what_display_nitification()
> >> }
> >> }
>
> >> Regards
>
> >> --
> >> 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...@chromium.org.
> >> To unsubscribe from this group, send email to
> >> chromium-extensions+unsubscr...@chromium.org.
> >> For more options, visit this group at
> >>http://groups.google.com/a/chromium.org/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...@chromium.org.
> > To unsubscribe from this group, send email to
> > chromium-extensions+unsubscr...@chromium.org.

Mahipal Singh Rathore

unread,
May 21, 2020, 8:33:53 AM5/21/20
to Chromium Extensions
Hello,

i am trying to create extension which runs every after 5-10 seconds, can you help me with this. 

PhistucK

unread,
May 21, 2020, 9:31:41 AM5/21/20
to Mahipal Singh Rathore, Chromium Extensions
It is always nice to reminisce about almost decade old threads.

Chrome extensions now have the chrome.alarms API. There are samples for its usage.

PhistucK


You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/d64f8fc9-d88f-4506-8eef-68c10e8adc29%40chromium.org.
Reply all
Reply to author
Forward
0 new messages