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

export default async function clearCacheHandler(event: MouseEvent): Promise<void> {
	await cache.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);
}