Skip to content

Add a custom Web Component

Refer to the CanvasComponent.ts in the frontend for an example.

  1. Create a class with the name [Name]Component, for example MyComponent.
  2. Extend the class from HTMLElement.
  3. Add the required logic to render your component.
  4. Register the component inside index.ts with. Make sure the element name exists out of at least two components seperated by a dash, for example: game-my.
  5. Add your component to the Page enumeration in RootComponent.ts, for example My = "my".
  6. Add your component to the switch (this._currentPage) in RootComponent.ts.

To instruct the frontend to switch to your Web Component, return a SwitchPageActionResult from an action on the backend.