summaryrefslogtreecommitdiff
path: root/source/helpers/clear-cache-handler.ts
blob: 7e427d0a35fbfb49a1950a7d20dca9d4f925fcde (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
import {globalCache} from 'webext-storage-cache';

export default async function clearCacheHandler(event: MouseEvent): Promise<void> {
	await globalCache.clear();
	const button = event.target as HTMLButtonElement;
	const initialText = button.textContent;
	button.textContent = 'Cache cleared!';
	button.disabled = true;
	setTimeout(() => {
		button.textContent = initialText;
		button.disabled = false;
	}, 2000);
}