refactor guid gen

This commit is contained in:
quenousimporte 2024-02-02 10:41:02 +01:00
parent 090c04eedd
commit 47f0907e77
1 changed files with 7 additions and 2 deletions

View File

@ -312,6 +312,11 @@ var snippets = [
insert: "x " + (new Date).toISOString().substring(0, 10) + " "
}];
function genguid()
{
return crypto.randomUUID();
}
function purgetodo() {
if (currentistodo() && confirm("Remove completed tasks?"))
{
@ -1180,7 +1185,7 @@ function loadstorage()
{
notesindex = {};
// todo: refactor in "add new note"
var guid = crypto.randomUUID();
var guid = genguid();
var content = defaultheaders();
var item = {
title: timestamp(),
@ -1306,7 +1311,7 @@ function migratelegacystorage()
var index = {};
legacy.forEach(note =>
{
var guid = crypto.randomUUID();
var guid = genguid();
localStorage.setItem(guid, note.content);
note.tags = gettags(note.content);
delete note.content;