From 8d7eef677e03846397e49177d9821f5cdc3df6b2 Mon Sep 17 00:00:00 2001 From: Melissa Zhang Date: Tue, 4 Aug 2020 19:44:14 -0700 Subject: stop clicking on invisible WebDoc in MainView.tsx after editSuccess --- src/client/apis/hypothesis/HypothesisUtils.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/client/apis/hypothesis') diff --git a/src/client/apis/hypothesis/HypothesisUtils.ts b/src/client/apis/hypothesis/HypothesisUtils.ts index 16f132e97..8d941cac6 100644 --- a/src/client/apis/hypothesis/HypothesisUtils.ts +++ b/src/client/apis/hypothesis/HypothesisUtils.ts @@ -50,16 +50,16 @@ export namespace Hypothesis { var success = false; const onSuccess = action(() => { - console.log("EDITSUCCESS"); + console.log("EDIT SUCCESS"); + success = true; clearTimeout(interval); DocumentLinksButton.invisibleWebDoc = undefined; document.removeEventListener("editSuccess", onSuccess); - success = true; }); - console.log("SEND addLink"); + console.log("send addLink"); const newHyperlink = `[${title}\n](${url})`; - const interval = setInterval(() => // keep trying to scroll every 250ms until annotations have loaded and editing is successful + const interval = setInterval(() => // keep trying to edit until annotations have loaded and editing is successful !success && document.dispatchEvent(new CustomEvent<{ newHyperlink: string, id: string }>("addLink", { detail: { newHyperlink: newHyperlink, id: annotationId }, bubbles: true @@ -70,7 +70,7 @@ export namespace Hypothesis { clearInterval(interval); DocumentLinksButton.invisibleWebDoc = undefined; } - }), 15000); // give up if no success after 15s + }), 12000); // give up if no success after 12s document.addEventListener("editSuccess", onSuccess); }; -- cgit v1.2.3-70-g09d2