From 86f5a109a786cab289af1795b547a44f8b9bfc7f Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Sun, 24 Apr 2016 15:59:32 +0200 Subject: [PATCH] #108: function to generate a UUID --- static/js/eventman.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/static/js/eventman.js b/static/js/eventman.js index 85df7af..7d7e385 100644 --- a/static/js/eventman.js +++ b/static/js/eventman.js @@ -6,3 +6,11 @@ String.prototype.getTime = function() { return new Date(ms); }; + +/* UUID generator. */ +function guid() { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + } + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); +}