「校務行政系統」修訂間的差異
跳至導覽
跳至搜尋
Yianlee2008(留言 | 貢獻) (建立內容為「史上最慢的系統 [https://cysh-cy.k12ea.gov.tw/SCH_UI/ 坐火箭前往車站搭蝸牛] = 技術紀載 = == 平均載入時間== 3.5秒 == 閒置自動登…」的新頁面) |
Yianlee2008(留言 | 貢獻) |
||
行 14: | 行 14: | ||
或是呼叫"compositionupdate"的事件也可以觸發 | 或是呼叫"compositionupdate"的事件也可以觸發 | ||
− | 相關程式碼寫於ASLoadProgress.js | + | 相關程式碼寫於ASLoadProgress.js |
− | event listener: | + | event listener: |
+ | <syntaxhighlight lang="javascript" line start="237"> | ||
+ | 237|window.addEventListener("compositionupdate", resetTimer); | ||
+ | </syntaxhighlight> | ||
− | resetTimer: | + | resetTimer: |
− | <syntaxhighlight lang="javascript" line> | + | <syntaxhighlight lang="javascript" line start="323"> |
− | function resetTimer() { | + | 323|function resetTimer() { |
− | + | 324| console.log("resetTimer"); | |
− | + | 325| window.top.clearTimeout(ast); | |
− | + | 326| var sessionTimeoutWarning = 20; //min | |
− | + | 327| var sTimeout = parseInt(sessionTimeoutWarning) * 60 * 1000; | |
− | + | 328| ast = window.top.setTimeout(logout, sTimeout); | |
− | + | 329| var current = new Date(); | |
− | + | 330| if (((current.getTime() - aspostback.getTime())/60000)>15) | |
− | + | 331| { | |
− | + | 332| try { | |
− | + | 333| var astimerclient = getXmlHttpRequestObject(); | |
− | + | 334| astimerclient.open("GET", encodeURI("AsCheck.ashx"), false); | |
− | + | 335| astimerclient.send(); | |
− | + | 336| } | |
− | + | 337| catch (e) { | |
− | + | 338| } | |
− | + | 339| aspostback = new Date(); | |
− | + | 340| console.log("AsCheck"); | |
− | + | 341| } | |
− | + | 342| // 1000 milisec = 1 sec | |
− | + | 343| } | |
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
+ | === 登出方法 === |
於 2024年7月9日 (二) 18:44 的修訂
史上最慢的系統
技術紀載
平均載入時間
3.5秒
閒置自動登出
20分鐘
可使用resetTimer();來防止(如果你能access的話)
或是呼叫"compositionupdate"的事件也可以觸發
相關程式碼寫於ASLoadProgress.js
event listener:
237|window.addEventListener("compositionupdate", resetTimer);
resetTimer:
323|function resetTimer() {
324| console.log("resetTimer");
325| window.top.clearTimeout(ast);
326| var sessionTimeoutWarning = 20; //min
327| var sTimeout = parseInt(sessionTimeoutWarning) * 60 * 1000;
328| ast = window.top.setTimeout(logout, sTimeout);
329| var current = new Date();
330| if (((current.getTime() - aspostback.getTime())/60000)>15)
331| {
332| try {
333| var astimerclient = getXmlHttpRequestObject();
334| astimerclient.open("GET", encodeURI("AsCheck.ashx"), false);
335| astimerclient.send();
336| }
337| catch (e) {
338| }
339| aspostback = new Date();
340| console.log("AsCheck");
341| }
342| // 1000 milisec = 1 sec
343| }