Skip to content

Instantly share code, notes, and snippets.

View juanluisja1's full-sized avatar

Juan Jimenez juanluisja1

View GitHub Profile
@juanluisja1
juanluisja1 / uuid.js
Created November 1, 2023 22:07 — forked from ifandelse/uuid.js
Looking for "Good Enough" client-side UUID generator
/*
I cannot claim this - it was recommended by a friend as a 'good enough' unique id generator
for local client side scenarios in the browser. The use case I'm looking to address has to
do with cross-frame messaging, where each point of origin needs a unique id (to be used as an
"origin" or correlation identifier). Therefore - the IDs do not need to be unique on a large
scale (e.g. - across a vast network of connected clients), but only in the browser, locally,
for the life of the session. Question is: is this good enough?
*/
function createUUID() {
var s = [];