From 2245963ab154c7e210f2132dbab6a30baac186f0 Mon Sep 17 00:00:00 2001 From: lzzfnc Date: Tue, 2 Nov 2021 02:17:12 +0100 Subject: [PATCH] todos about promises --- script.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/script.js b/script.js index bd7a1c5..ddd2d90 100644 --- a/script.js +++ b/script.js @@ -94,8 +94,11 @@ function drawLabel() { let height = maxY - minY; if (width > minimumSizeX && height > minimumSizeY) { - new Promise(function (resolve, reject) { - // TODO: show the modal for text input then if insert and value --> resolve, if cancel --> reject + let userInput = new Promise(function (resolve, reject) { + // TODO: show the modal for text input in overlay + // TODO: temp editor freeze before the label is created + // then if the user click insert and there is a value in the input-- > resolve the promise and return the text input to create the label, + // if the user click cancel-- > reject the promise and don't create the label insert.addEventListener("click", (e) => { if (input.value) { resolve(input.value);