UNPKG

static-browser-server

Version:

A simple service worker used for the static template in sandpack, allowing users to develop websites like they would locally in the browser.

9 lines (7 loc) 231 B
let counter = 0; export function generateRandomId() { const now = Date.now(); const randomNumber = Math.round(Math.random() * 10000); const count = (counter += 1); return (+`${now}${randomNumber}${count}`).toString(16); }