Migrate some more things to typescript

This commit is contained in:
Tamius Han 2021-03-11 21:04:09 +01:00
parent 6a1f07d881
commit ede570865f
6 changed files with 10 additions and 6 deletions

View File

@ -1,3 +0,0 @@
export async function sleep(timeout) {
return new Promise( (resolve, reject) => setTimeout(() => resolve(), timeout));
}

3
src/common/js/utils.ts Normal file
View File

@ -0,0 +1,3 @@
export async function sleep(timeout) {
return new Promise<void>( (resolve, reject) => setTimeout(() => resolve(), timeout));
}

View File

@ -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 { class ExecAction {
settings: Settings;
site: any;
constructor(settings, site) { constructor(settings, site) {
this.settings = settings; this.settings = settings;
this.site = site; this.site = site;
@ -24,7 +28,7 @@ class ExecAction {
arg: cmd.arg, arg: cmd.arg,
customArg: cmd.customArg customArg: cmd.customArg
} }
Comms.sendMessage(message); browser.runtime.sendMessage(message);
} else { } else {
// set-ar-persistence sends stuff to content scripts as well (!) // 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 // this hopefully delays settings.save() until current crops are saved on the site
// and thus avoid any fucky-wuckies // and thus avoid any fucky-wuckies
await Comms.sendMessage(message); await browser.runtime.sendMessage(message);
} }
let site = this.site; let site = this.site;