From ede570865f31bf5b66ba3d6a40a9b0ac22edefdd Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Thu, 11 Mar 2021 21:04:09 +0100 Subject: [PATCH] Migrate some more things to typescript --- ...ssMitigations.js => ChromeShittinessMitigations.ts} | 0 src/common/js/{IO.js => IO.ts} | 0 ...oardShortcutParser.js => KeyboardShortcutParser.ts} | 0 src/common/js/utils.js | 3 --- src/common/js/utils.ts | 3 +++ src/popup/js/{ExecAction.js => ExecAction.ts} | 10 +++++++--- 6 files changed, 10 insertions(+), 6 deletions(-) rename src/common/js/{ChromeShittinessMitigations.js => ChromeShittinessMitigations.ts} (100%) rename src/common/js/{IO.js => IO.ts} (100%) rename src/common/js/{KeyboardShortcutParser.js => KeyboardShortcutParser.ts} (100%) delete mode 100644 src/common/js/utils.js create mode 100644 src/common/js/utils.ts rename src/popup/js/{ExecAction.js => ExecAction.ts} (90%) diff --git a/src/common/js/ChromeShittinessMitigations.js b/src/common/js/ChromeShittinessMitigations.ts similarity index 100% rename from src/common/js/ChromeShittinessMitigations.js rename to src/common/js/ChromeShittinessMitigations.ts diff --git a/src/common/js/IO.js b/src/common/js/IO.ts similarity index 100% rename from src/common/js/IO.js rename to src/common/js/IO.ts diff --git a/src/common/js/KeyboardShortcutParser.js b/src/common/js/KeyboardShortcutParser.ts similarity index 100% rename from src/common/js/KeyboardShortcutParser.js rename to src/common/js/KeyboardShortcutParser.ts diff --git a/src/common/js/utils.js b/src/common/js/utils.js deleted file mode 100644 index 51b48a3..0000000 --- a/src/common/js/utils.js +++ /dev/null @@ -1,3 +0,0 @@ -export async function sleep(timeout) { - return new Promise( (resolve, reject) => setTimeout(() => resolve(), timeout)); -} diff --git a/src/common/js/utils.ts b/src/common/js/utils.ts new file mode 100644 index 0000000..990473b --- /dev/null +++ b/src/common/js/utils.ts @@ -0,0 +1,3 @@ +export async function sleep(timeout) { + return new Promise( (resolve, reject) => setTimeout(() => resolve(), timeout)); +} diff --git a/src/popup/js/ExecAction.js b/src/popup/js/ExecAction.ts similarity index 90% rename from src/popup/js/ExecAction.js rename to src/popup/js/ExecAction.ts index 6baf140..3b5f31f 100644 --- a/src/popup/js/ExecAction.js +++ b/src/popup/js/ExecAction.ts @@ -1,6 +1,10 @@ -import Comms from '../../ext/lib/comms/Comms'; +import { browser } from '../../../node_modules/webextension-polyfill-ts/lib/index'; +import Settings from '../../ext/lib/Settings'; class ExecAction { + settings: Settings; + site: any; + constructor(settings, site) { this.settings = settings; this.site = site; @@ -24,7 +28,7 @@ class ExecAction { arg: cmd.arg, customArg: cmd.customArg } - Comms.sendMessage(message); + browser.runtime.sendMessage(message); } else { // set-ar-persistence sends stuff to content scripts as well (!) @@ -41,7 +45,7 @@ class ExecAction { } // this hopefully delays settings.save() until current crops are saved on the site // and thus avoid any fucky-wuckies - await Comms.sendMessage(message); + await browser.runtime.sendMessage(message); } let site = this.site;