Manatok
Manatok

Reputation: 5706

Polling the server in background

I am busy developing a Firefox extension and I have a Widget that opens a Panel. How do I have a background script that is constantly running/polling the server to fetch updates. These updates would then need to be injected into the DOM of the Panel.

Upvotes: 1

Views: 612

Answers (1)

Wladimir Palant
Wladimir Palant

Reputation: 57681

All of your extension scripts are "background scripts". What you are asking about seems to be a way to poll the server regularly - you use the timers module for that, method setInterval(). The callback would than use the request module to send a request to the server.

As to communicating information to a widget/panel - you use the usual approach to send messages to the content scripts running there.

Upvotes: 2

Related Questions