refactor: migrate standalone scripts to the new DI architecture
Bug: twpowertools:226
Change-Id: Ie32b0200a31626bde06f3bdb0655790bb5a76802
diff --git a/src/presentation/standaloneScripts/mainWorldServers/MWI18nServerScript.script.ts b/src/presentation/standaloneScripts/mainWorldServers/MWI18nServerScript.script.ts
new file mode 100644
index 0000000..86d28fa
--- /dev/null
+++ b/src/presentation/standaloneScripts/mainWorldServers/MWI18nServerScript.script.ts
@@ -0,0 +1,17 @@
+import Script, { ScriptEnvironment, ScriptPage, ScriptRunPhase } from "../../../common/architecture/scripts/Script"
+import MWI18nServer from "../../../common/mainWorldI18n/Server";
+
+export default class MWI18nServerScript extends Script {
+ // The server should be available as soon as possible, since e.g. the
+ // XHRProxy already sends a request to the optionsWatcher server as soon as it
+ // is constructed.
+ priority = 1;
+
+ page = ScriptPage.CommunityConsole;
+ environment = ScriptEnvironment.ContentScript;
+ runPhase = ScriptRunPhase.Start;
+
+ execute() {
+ new MWI18nServer();
+ }
+}
diff --git a/src/presentation/standaloneScripts/mainWorldServers/MWOptionsWatcherServerScript.script.ts b/src/presentation/standaloneScripts/mainWorldServers/MWOptionsWatcherServerScript.script.ts
new file mode 100644
index 0000000..464a7fa
--- /dev/null
+++ b/src/presentation/standaloneScripts/mainWorldServers/MWOptionsWatcherServerScript.script.ts
@@ -0,0 +1,18 @@
+import Script, { ScriptEnvironment, ScriptPage, ScriptRunPhase } from "../../../common/architecture/scripts/Script"
+import MWOptionsWatcherServer from "../../../common/mainWorldOptionsWatcher/Server"
+import { kCSTarget, kMWTarget } from "../../../xhrInterceptor/responseModifiers"
+
+export default class MWOptionsWatcherServerScript extends Script {
+ // The server should be available as soon as possible, since e.g. the
+ // XHRProxy already sends a request to the optionsWatcher server as soon as it
+ // is constructed.
+ priority = 0;
+
+ page = ScriptPage.CommunityConsole;
+ environment = ScriptEnvironment.ContentScript;
+ runPhase = ScriptRunPhase.Start;
+
+ execute() {
+ new MWOptionsWatcherServer(kCSTarget, kMWTarget);
+ }
+}