Browse Source

minor change

master
Gregor Wüst 4 years ago
parent
commit
20287ddfbc
1 changed files with 10 additions and 5 deletions
  1. 10
    5
      scripts/notes_app.js

+ 10
- 5
scripts/notes_app.js View File

} }
} }


async function getItemFromStorage(idTmp){
return new Promise(resolve => {
let item = JSON.parse(localStorage.getItem('noteObj'+idTmp));
console.log("in promise "+item);
resolve(item);
});
}


async function getSavedNote(id){ async function getSavedNote(id){
console.log("getSavedNote() "+ id); console.log("getSavedNote() "+ id);
createLoadingSign("", "allNotesDiv"); createLoadingSign("", "allNotesDiv");
console.log("id before split " + id); console.log("id before split " + id);
let idTmp = id.split("_")[1]; let idTmp = id.split("_")[1];
console.log("idTmp " +idTmp); console.log("idTmp " +idTmp);
let item = await new Promise(resolve => {
let item = JSON.parse(localStorage.getItem('noteObj'+idTmp));
console.log("in promise "+item);
resolve(item);
})
let item = await getItemFromStorage(idTmp);
console.log(item); console.log(item);
createFormWithSavedContent(item, idTmp); createFormWithSavedContent(item, idTmp);
} }

Loading…
Cancel
Save