I am working with the sample application and wanted to add some functionality to the desktop window, but I cannot get the desktop.ts file to run, here is how the desktop.ts file is setup:
import { AppWindow } from "../AppWindow";
import { windowNames } from "../../consts";
import $ = require("jquery");
new AppWindow(windowNames.desktop);
class Desktop {
private static _instance: Desktop;
private constructor() {
const loginButton = document.getElementById('loginButton');
loginButton.addEventListener('click', () => {
alert("clicked");
});
}
And I have changed the way it is called from the background.ts file:
public async run() {
this._hearthstoneGameListener.start();
const currWindow = windowNames.desktop;
this._windows[currWindow].restore();
}
But when I load the application, the click event for the login button is not working and it seems like the desktop.ts file is not being called with the window.restore?
I used to have this event listener inside of the appwindow.ts file and it worked fine, but I assumed that it would be better to have this sort of functionality inside of the desktop.ts folder as that is the window which holds my HTML for the first view the user will see.
Please can someone clear up what I’m doing wrong and the correct way to go about navigating through an OW app cleanly?