LoginSignup
0
0

More than 3 years have passed since last update.

javascrpitで自動更新処理

Posted at

60秒で自動更新


const timer = 60000    // ミリ秒で間隔の時間を指定
window.addEventListener('load',function(){
  setInterval('location.reload()',timer);
});

イベント実行時に画面も更新

  • /stopへリクエストして、5秒後に画面リロード
    handleClickStop() {
        const request = axios.create({
            baseURL: "http://localhost:8080"
        })
        request.post("/stop")
        setTimeout(window.location.reload(),5000);
    }

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0