表示されているタブのスクリーンショットを取得できるクロム拡張機能を作成しました。ここで、ボタンを押さずに一定時間後に拡張機能が自動的に写真を撮るようにします。どうすればそれができますか?
2230 次
1 に答える
1
JavascriptsetTimeout
と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);
これにより、10 秒後にスクリーンショットが取得されます。表示されているタブのスクリーンショットを秒単位で撮るには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);
于 2011-06-06T14:04:15.880 に答える