aboutsummaryrefslogtreecommitdiff
path: root/ext/js/accessibility/google-docs.js
diff options
context:
space:
mode:
authorDarius Jahandarie <djahandarie@gmail.com>2023-12-06 03:53:16 +0000
committerGitHub <noreply@github.com>2023-12-06 03:53:16 +0000
commitbd5bc1a5db29903bc098995cd9262c4576bf76af (patch)
treec9214189e0214480fcf6539ad1c6327aef6cbd1c /ext/js/accessibility/google-docs.js
parentfd6bba8a2a869eaf2b2c1fa49001f933fce3c618 (diff)
parent23e6fb76319c9ed7c9bcdc3efba39bc5dd38f288 (diff)
Merge pull request #339 from toasted-nutbread/type-annotations
Type annotations
Diffstat (limited to 'ext/js/accessibility/google-docs.js')
-rw-r--r--ext/js/accessibility/google-docs.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/ext/js/accessibility/google-docs.js b/ext/js/accessibility/google-docs.js
index f9290078..27841b6d 100644
--- a/ext/js/accessibility/google-docs.js
+++ b/ext/js/accessibility/google-docs.js
@@ -18,9 +18,17 @@
(async () => {
// Reentrant check
+ // @ts-expect-error - Checking a property to the global object
if (self.googleDocsAccessibilitySetup) { return; }
+ // @ts-expect-error - Adding a property to the global object
self.googleDocsAccessibilitySetup = true;
+ /**
+ * @template [TReturn=unknown]
+ * @param {string} action
+ * @param {import('core').SerializableObject} params
+ * @returns {Promise<TReturn>}
+ */
const invokeApi = (action, params) => {
return new Promise((resolve, reject) => {
chrome.runtime.sendMessage({action, params}, (response) => {
@@ -37,6 +45,7 @@
};
const optionsContext = {depth: 0, url: location.href};
+ /** @type {import('api').OptionsGetResult} */
let options;
try {
options = await invokeApi('optionsGet', {optionsContext});
@@ -48,9 +57,8 @@
// The extension ID below is on an allow-list that is used on the Google Docs webpage.
/* eslint-disable */
- const inject = () => {
- window._docs_annotate_canvas_by_ext = 'ogmnaimimemjmbakcfefmnahgdfhfami';
- };
+ // @ts-expect-error : Adding a property to the global object
+ const inject = () => { window._docs_annotate_canvas_by_ext = 'ogmnaimimemjmbakcfefmnahgdfhfami'; };
/* eslint-enable */
let parent = document.head;