gestor_dataset/server_side/stats.worker.js
2025-06-27 11:16:24 -04:00

12 lines
345 B
JavaScript

self.onmessage = function(e) {
const table = e.data.table;
function fetchStats() {
fetch(`stats_worker.php?table=${encodeURIComponent(table)}`)
.then(response => response.json())
.then(data => {
self.postMessage(data);
setTimeout(fetchStats, 5000); // Consulta cada 5 segundos
});
}
fetchStats();
};