From: Steinar H. Gunderson Date: Tue, 27 Dec 2022 17:08:42 +0000 (+0100) Subject: Cheaper createId(). X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;ds=sidebyside;h=38312204f04624996e251fbc1d1ad21ba3c3c5b7;p=remoteglot Cheaper createId(). --- diff --git a/www/js/chessboard-0.3.0.js b/www/js/chessboard-0.3.0.js index b979617..477d778 100644 --- a/www/js/chessboard-0.3.0.js +++ b/www/js/chessboard-0.3.0.js @@ -259,12 +259,9 @@ var BOARD_BORDER_SIZE = 2, // JS Util Functions //------------------------------------------------------------------------------ -// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript +let id_counter = 0; function createId() { - return 'xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx'.replace(/x/g, function(c) { - var r = Math.random() * 16 | 0; - return r.toString(16); - }); + return 'chesspiece-id-' + (id_counter++); } function deepCopy(thing) {