小さな通知と警告システムがあります。
ウィンドウの状態がぼかしかフォーカスかを検出し、これらのアラートと通知を一覧表示しようとしています。しかし、私の clearInterval メソッドは機能しません。コードは次のとおりです。
$(document).ready(function(){
setTimeout(function(){loadMessageNotifications()},600);
setTimeout(function(){loadStoryNotifications()},400);
var intervalStoryAlerts = setInterval(function(){loadStoryAlerts()},6000);
var intervalMessageAlerts = setInterval(function(){loadMessageAlerts()},16000);
$(window).bind("focus", function(event){
setTimeout(function(){loadMessageNotifications()},600);
setTimeout(function(){loadStoryNotifications()},400);
var intervalStoryAlerts = setInterval(function(){loadStoryAlerts()},6000);
var intervalMessageAlerts = setInterval(function(){loadMessageAlerts()},16000);
}).bind("blur", function(event){
clearInterval(intervalStoryAlerts);
clearInterval(intervalMessageAlerts);
});
});
これらの clearInterval の console.log() 出力は未定義です。