aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/HypothesisUtils.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-04-29 23:51:24 -0400
committerbobzel <zzzman@gmail.com>2024-04-29 23:51:24 -0400
commit9dc32440852c8af3575687d96f0442bf18542671 (patch)
treea8ccabb95170bc1dac2822e4d7c7570f05a3e898 /src/client/util/HypothesisUtils.ts
parent8d68db4de347e772a5272fd0519fa30c03a30db4 (diff)
more eslint
Diffstat (limited to 'src/client/util/HypothesisUtils.ts')
-rw-r--r--src/client/util/HypothesisUtils.ts21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/client/util/HypothesisUtils.ts b/src/client/util/HypothesisUtils.ts
index 6dc96f1b5..dd18b2533 100644
--- a/src/client/util/HypothesisUtils.ts
+++ b/src/client/util/HypothesisUtils.ts
@@ -15,6 +15,7 @@ export namespace Hypothesis {
* If none exist, create and return a new WebDocument.
*/
export const getSourceWebDoc = async (uri: string) => {
+ // eslint-disable-next-line no-use-before-define
const result = await findWebDoc(uri);
console.log(result ? 'existing doc found' : 'existing doc NOT found');
return result || Docs.Create.WebDocument(uri, { title: uri, _nativeWidth: 850, _height: 512, _width: 400, data_useCors: true }); // create and return a new Web doc with given uri if no matching docs are found
@@ -75,17 +76,19 @@ export namespace Hypothesis {
/**
* Send message to Hypothes.is client to edit an annotation to add a Dash hyperlink
*/
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
export const makeLink = async (title: string, url: string, annotationId: string, annotationSourceDoc: Doc) => {
// if the annotation's source webpage isn't currently loaded in Dash, we're not able to access and edit the annotation from the client
// so we're loading the webpage and its annotations invisibly in a WebBox in MainView.tsx, until the editing is done
- //!DocumentManager.Instance.getFirstDocumentView(annotationSourceDoc) && runInAction(() => DocumentLinksButton.invisibleWebDoc = annotationSourceDoc);
+ //! DocumentManager.Instance.getFirstDocumentView(annotationSourceDoc) && runInAction(() => DocumentLinksButton.invisibleWebDoc = annotationSourceDoc);
- var success = false;
+ let success = false;
const onSuccess = action(() => {
console.log('Edit success!!');
success = true;
+ // eslint-disable-next-line no-use-before-define
clearTimeout(interval);
- //DocumentLinksButton.invisibleWebDoc = undefined;
+ // DocumentLinksButton.invisibleWebDoc = undefined;
document.removeEventListener('editSuccess', onSuccess);
});
@@ -107,7 +110,7 @@ export namespace Hypothesis {
action(() => {
if (!success) {
clearInterval(interval);
- //DocumentLinksButton.invisibleWebDoc = undefined;
+ // DocumentLinksButton.invisibleWebDoc = undefined;
}
}),
10000
@@ -121,12 +124,13 @@ export namespace Hypothesis {
export const deleteLink = async (linkDoc: Doc, sourceDoc: Doc, destinationDoc: Doc) => {
if (Cast(destinationDoc.data, WebField)?.url.href !== StrCast(linkDoc.annotationUri)) return; // check that the destinationDoc is a WebDocument containing the target annotation
- //!DocumentManager.Instance.getFirstDocumentView(destinationDoc) && runInAction(() => DocumentLinksButton.invisibleWebDoc = destinationDoc); // see note in makeLink
+ //! DocumentManager.Instance.getFirstDocumentView(destinationDoc) && runInAction(() => DocumentLinksButton.invisibleWebDoc = destinationDoc); // see note in makeLink
- var success = false;
+ let success = false;
const onSuccess = action(() => {
console.log('Edit success!');
success = true;
+ // eslint-disable-next-line no-use-before-define
clearTimeout(interval);
// DocumentLinksButton.invisibleWebDoc = undefined;
document.removeEventListener('editSuccess', onSuccess);
@@ -149,7 +153,7 @@ export namespace Hypothesis {
action(() => {
if (!success) {
clearInterval(interval);
- //DocumentLinksButton.invisibleWebDoc = undefined;
+ // DocumentLinksButton.invisibleWebDoc = undefined;
}
}),
10000
@@ -161,10 +165,11 @@ export namespace Hypothesis {
* Send message to Hypothes.is client to scroll to an annotation when it loads
*/
export const scrollToAnnotation = (annotationId: string, target: Doc) => {
- var success = false;
+ let success = false;
const onSuccess = () => {
console.log('Scroll success!!');
document.removeEventListener('scrollSuccess', onSuccess);
+ // eslint-disable-next-line no-use-before-define
clearInterval(interval);
success = true;
};