A FoundryVTT module for playing at an in-person table.
1import { mount } from "svelte";
2import UniControl from "./svelte/unicontrol.svelte";
3
4export default class UniversalControl extends foundry.applications.api.ApplicationV2 {
5 static override get DEFAULT_OPTIONS() {
6 return foundry.utils.mergeObject(
7 super.DEFAULT_OPTIONS,
8 {
9 actions: [],
10 classes: [
11 "sheet",
12 "application"
13 ],
14 id: "universal-control",
15 position: {
16 left: 0,
17 top: 0,
18 width: window.innerWidth,
19 height: window.innerHeight
20 },
21 window: {
22 resizable: false
23 }
24 }
25 );
26 }
27
28 _renderHTML(context: any, options: foundry.applications.types.ApplicationRenderOptions): Promise<any> {
29 console.log(context);
30
31 return new Promise((resolve: (value: string) => void): void => {
32 resolve((game as foundry.Game).user.id);
33 });
34 }
35
36 /*override render(options?: boolean | foundry.applications.types.ApplicationRenderOptions, _options?: foundry.applications.types.ApplicationRenderOptions): Promise<this> {
37 if (document.getElementById("universal-control") === null) {
38 super.render(options).then((value: this): void => {
39 mount(UniControl, {
40 target: value.element,
41 props: {}
42 });
43 });
44 }
45
46 return new Promise((resolve: (value: this) => void): void => {
47 resolve(this);
48 });
49 }*/
50
51 _replaceHTML(id: string, element: HTMLElement, options: any): void {
52 element.innerHTML = "";
53
54 mount(UniControl, {
55 target: element,
56 props: {}
57 });
58 }
59}