Bringing over stuff from the test files.
This commit is contained in:
45
src/ts/module.ts
Normal file
45
src/ts/module.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { CharacterManagerClient } from "../proto/character.client";
|
||||
import { GetCharacterRequest } from '../proto/character'
|
||||
import { GrpcWebFetchTransport } from '@protobuf-ts/grpcweb-transport'
|
||||
|
||||
import { ModuleData } from "@league-of-foundry-developers/foundry-vtt-types/src/foundry/common/packages.mjs";
|
||||
import { id as moduleId } from "../module.json";
|
||||
import DogBrowser from "./apps/NewCharacter";
|
||||
|
||||
|
||||
interface MyModule extends Game.ModuleData<ModuleData> {
|
||||
dogBrowser: DogBrowser;
|
||||
}
|
||||
|
||||
let module: MyModule;
|
||||
|
||||
Hooks.once("init", async () => {
|
||||
console.log("hello world!");
|
||||
|
||||
|
||||
const client = new CharacterManagerClient(
|
||||
new GrpcWebFetchTransport({
|
||||
baseUrl: 'http://localhost/api',
|
||||
format: 'binary',
|
||||
}),
|
||||
);
|
||||
|
||||
console.log("Potato");
|
||||
let request = GetCharacterRequest.fromJson({
|
||||
})
|
||||
console.log("Potato");
|
||||
let a = await client.getCharacter(request).then((res) => {
|
||||
console.log(res)
|
||||
return res
|
||||
})
|
||||
|
||||
console.log(a.response)
|
||||
|
||||
console.log("Potato");
|
||||
|
||||
console.log(`Initializing ${moduleId}`);
|
||||
|
||||
module = (game as Game).modules.get(moduleId) as MyModule;
|
||||
module.dogBrowser = new DogBrowser();
|
||||
module.dogBrowser.render(true);
|
||||
});
|
||||
Reference in New Issue
Block a user