testbed: mount agents in a seperate div

mostly to test that works
This commit is contained in:
Lily Tsuru 2024-07-10 07:15:19 -04:00
parent 7e1999f117
commit d5b7e174a1
2 changed files with 7 additions and 2 deletions

View file

@ -24,5 +24,8 @@
<input type="submit" value="Load"/> <input type="submit" value="Load"/>
</form> </form>
</div> </div>
<!-- This is where all Agents go -->
<div id="agent-mount">
</div>
</body> </body>
</html> </html>

View file

@ -6,6 +6,8 @@ let w = window as any;
w.agents = []; w.agents = [];
let input = document.getElementById("testbed-input") as HTMLInputElement; let input = document.getElementById("testbed-input") as HTMLInputElement;
let mount = document.getElementById("agent-mount") as HTMLDivElement;
input.addEventListener("change", async () => { input.addEventListener("change", async () => {
let buffer = await input.files![0].arrayBuffer(); let buffer = await input.files![0].arrayBuffer();
@ -14,7 +16,7 @@ input.addEventListener("change", async () => {
w.agents.push(agent); w.agents.push(agent);
agent.addToDom(document.body); agent.addToDom(mount);
agent.show(); agent.show();
console.log("Agent created"); console.log("Agent created");
@ -35,4 +37,4 @@ form.addEventListener('submit', e => {
agent.show(); agent.show();
console.log(`Loaded agent from ${url}`); console.log(`Loaded agent from ${url}`);
}); });
}); });