refactor guid gen
This commit is contained in:
parent
090c04eedd
commit
47f0907e77
9
main.js
9
main.js
|
@ -312,6 +312,11 @@ var snippets = [
|
||||||
insert: "x " + (new Date).toISOString().substring(0, 10) + " "
|
insert: "x " + (new Date).toISOString().substring(0, 10) + " "
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
function genguid()
|
||||||
|
{
|
||||||
|
return crypto.randomUUID();
|
||||||
|
}
|
||||||
|
|
||||||
function purgetodo() {
|
function purgetodo() {
|
||||||
if (currentistodo() && confirm("Remove completed tasks?"))
|
if (currentistodo() && confirm("Remove completed tasks?"))
|
||||||
{
|
{
|
||||||
|
@ -1180,7 +1185,7 @@ function loadstorage()
|
||||||
{
|
{
|
||||||
notesindex = {};
|
notesindex = {};
|
||||||
// todo: refactor in "add new note"
|
// todo: refactor in "add new note"
|
||||||
var guid = crypto.randomUUID();
|
var guid = genguid();
|
||||||
var content = defaultheaders();
|
var content = defaultheaders();
|
||||||
var item = {
|
var item = {
|
||||||
title: timestamp(),
|
title: timestamp(),
|
||||||
|
@ -1306,7 +1311,7 @@ function migratelegacystorage()
|
||||||
var index = {};
|
var index = {};
|
||||||
legacy.forEach(note =>
|
legacy.forEach(note =>
|
||||||
{
|
{
|
||||||
var guid = crypto.randomUUID();
|
var guid = genguid();
|
||||||
localStorage.setItem(guid, note.content);
|
localStorage.setItem(guid, note.content);
|
||||||
note.tags = gettags(note.content);
|
note.tags = gettags(note.content);
|
||||||
delete note.content;
|
delete note.content;
|
||||||
|
|
Loading…
Reference in New Issue