Speed up top nav with turbo routing and external base CSS.
Remove view-transition lag, swap main content without full reload, prefetch pages, and tear down SSE timers on leave. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+14
-2
@@ -31,8 +31,20 @@
|
||||
.catch(function () { /* ignore */ });
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
function stopPolling() {
|
||||
if (keyTimer) {
|
||||
clearInterval(keyTimer);
|
||||
keyTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
function startPolling() {
|
||||
stopPolling();
|
||||
pollKeyPrices();
|
||||
keyTimer = setInterval(pollKeyPrices, 1000);
|
||||
});
|
||||
}
|
||||
|
||||
if (window.qihuoOnPageLoad) window.qihuoOnPageLoad(startPolling);
|
||||
else document.addEventListener('DOMContentLoaded', startPolling);
|
||||
if (window.qihuoOnPageLeave) window.qihuoOnPageLeave(stopPolling);
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user