UNPKG

@pmmmwh/react-refresh-webpack-plugin

Version:

An **EXPERIMENTAL** Webpack plugin to enable "Fast Refresh" (also previously known as _Hot Reloading_) for React components.

21 lines (17 loc) 495 B
function runWithRetry(callback, maxRetries) { function executeWithRetryAndTimeout(currentCount) { try { if (currentCount > maxRetries - 1) { console.warn('[React Refresh] Failed set up the socket connection.'); return; } callback(); } catch (err) { setTimeout(function () { executeWithRetryAndTimeout(currentCount + 1); }, Math.pow(10, currentCount)); } } executeWithRetryAndTimeout(0); } module.exports = runWithRetry;