feat: implement version check and update dialog; add browser cache clearing functionality
Build and Deploy / build (push) Successful in 1m40s
Build and Deploy / build (push) Successful in 1m40s
This commit is contained in:
@@ -106,6 +106,29 @@
|
||||
// اجرای اولیه (حتی اگر کاربر اسکرول نکرده)
|
||||
requestAnimationFrame(update);
|
||||
}
|
||||
|
||||
// پاک کردن کش مرورگر (Cache Storage و Service Worker)
|
||||
window.clearBrowserCache = async function() {
|
||||
// پاک کردن Cache Storage (Service Worker cache)
|
||||
if ('caches' in window) {
|
||||
const cacheNames = await caches.keys();
|
||||
await Promise.all(
|
||||
cacheNames.map(cacheName => caches.delete(cacheName))
|
||||
);
|
||||
console.log('Cache Storage cleared:', cacheNames.length, 'caches deleted');
|
||||
}
|
||||
|
||||
// پاک کردن Service Worker registration
|
||||
if ('serviceWorker' in navigator) {
|
||||
const registrations = await navigator.serviceWorker.getRegistrations();
|
||||
await Promise.all(
|
||||
registrations.map(registration => registration.unregister())
|
||||
);
|
||||
console.log('Service Workers unregistered:', registrations.length);
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user