OSDN Git Service

Fix the screen time recording system [0.2.1] feature/screentime
authormtsgi <oq@live.jp>
Fri, 27 Dec 2019 13:32:10 +0000 (22:32 +0900)
committermtsgi <oq@live.jp>
Fri, 27 Dec 2019 13:32:10 +0000 (22:32 +0900)
system.js

index cc8ff3b..74aec1c 100644 (file)
--- a/system.js
+++ b/system.js
@@ -1189,7 +1189,6 @@ const KWS = new function(){
                 localStorage.setItem('kit-screentime', JSON.stringify(KWS.screenTime));
             }
             else{
-                console.log(_pid + '外れました');
                 $("#"+array[i].id).removeClass("windowactive");
                 $("#t"+_pid).removeClass("t-active");
                 process[_pid].isactive = false;
@@ -1197,7 +1196,8 @@ const KWS = new function(){
                     let _diff = (new Date() - KWS.screenPrevSwitched);
                     let _appid = process[_pid].id
                     if( !KWS.screenTime[_appid] ) KWS.screenTime[_appid] = new Number();
-                    KWS.screenTime[_appid] += _diff;
+                    if( _diff < 0 ) Notification.push('debug', 'スクリーンタイムの記録に失敗しました。', 'system')
+                    else KWS.screenTime[_appid] += _diff;
                 }
             }
         }