Documentation

API Referencefunction

function useWebContext()

Initializes the web application context with renderer, viewport, and navigation.

function useWebContext(
config?: (opts: WebContextOptions) => void,
): AppContext;

Notes

Parameters

Return value

The global app context.

Description

Call this function once at application startup to configure the web handler. It can also be called again to reset application state, for example after logging out the current user.

Examples

// Start the application with default theme
const app = useWebContext();
app.addActivity(new MyActivity());
// Start with custom theme
const app = useWebContext(() => {
  setWebTheme(new WebTheme()
    .colors({ accent: "#FF5722" })
    .darkColors({ accent: "#FF7043" })
  );
});