This commit is contained in:
yumoqing 2024-10-09 15:26:25 +08:00
parent dfc79a1057
commit f2135c579f

View File

@ -47,13 +47,15 @@ dispatch_event:
params: params:
*/ */
bricks.uuid = window.crypto.randomUUID; bricks.uuid = function(){
return crypto.randomUUID();
}
bricks.deviceid = function(appname){ bricks.deviceid = function(appname){
var deviceid = appname + 'deviceid'; var deviceid = appname + 'deviceid';
var id = localStorage.getItem(deviceid); var id = localStorage.getItem(deviceid);
if (!id){ if (!id){
id = bricks.uuid(); id = crypto.randomUUID();
localStorage.setItem(deviceid, id); localStorage.setItem(deviceid, id);
} }
return id; return id;