0

表示されているタブのスクリーンショットを取得できるクロム拡張機能を作成しました。ここで、ボタンを押さずに一定時間後に拡張機能が自動的に写真を撮るようにします。どうすればそれができますか?

4

1 に答える 1

1

JavascriptsetTimeoutsetInterval.

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 に答える