28a00b6525aa5f7c25fe9561e4d078f48a5856dd
[Packages/TYPO3.CMS.git] / typo3 / sysext / adminpanel / Resources / Public / JavaScript / Modules / Cache.js
1 function initializeCacheModule() {
2 var buttons = Array.from(document.querySelectorAll('[data-typo3-role=clearCacheButton]'));
3
4 buttons.forEach(function (elem) {
5 elem.addEventListener('click', clearCache);
6 });
7 }
8
9 function clearCache() {
10 var url = this.dataset.typo3AjaxUrl;
11 var request = new XMLHttpRequest();
12 request.open("GET", url);
13 request.send();
14 request.onload = function () {
15 location.reload();
16 };
17 }
18
19 window.addEventListener('load', initializeCacheModule, false);