I have written a chrome extension which could take the visible tab's screenshot. Now, I want the extension to take pictures automatically after a certain interval of time without pressing the button. How could that be done ?
It should be pretty simple, just use the standard methods in Javascript setTimeout
and setInterval
.
var seconds = 10 * 1000;
var windowId = some window id;
setTimeout(function() {
chrome.tabs.captureVisibleTab(
some window id,
{},
function () { ... do something with the screen shot ;} )
}
, seconds);
This will take a screenshot after 10 seconds. To take a screenshot of the visible tab every to seconds use setInterval
var seconds = 10 * 1000;
var windowId = some window id;
setInterval(function() {
chrome.tabs.captureVisibleTab(
some window id,
{},
function () { ... do something with the screen shot ;} )
}
, seconds);