Main

backend.Main (Class)

Main entry point for Clay backend applications.

This class handles the initial setup and configuration of Clay applications, including platform-specific initialization for web, desktop, and mobile targets. It configures Clay's rendering settings, handles Electron integration, manages window sizing and orientation, and sets up the Ceramic application lifecycle.

Key responsibilities:

  • Clay framework initialization and configuration
  • Platform-specific setup (web, desktop, mobile)
  • Electron runner integration for development
  • Window and viewport management
  • Orientation handling for mobile devices
  • Error handling and logging setup

Static Members

clay
main(): Void

Main entry point for Clay backend applications.

Initializes the Clay framework with custom configuration and event handling. This is called automatically when the application starts.

Private Members

clay
project: Project

The Ceramic project instance.


clay
events: ClayEvents

Clay events handler instance for managing application lifecycle events.


clay
app: ceramic.App

The main Ceramic application instance.


clay
configure(config: clay.Config): Void

Configures Clay framework settings for the Ceramic application.

This function handles:

  • OpenGL/WebGL version configuration
  • Platform-specific rendering settings
  • Window configuration (size, fullscreen, resizable)
  • Electron runner integration and development features
  • Web-specific container and viewport handling
  • Mobile platform optimizations
  • Error handling setup
Name Type Description
config clay.Config The Clay configuration object to customize

clay
ready(): Void

Called when the Clay backend is ready and initialized.

This function handles final initialization steps including:

  • Key-value storage initialization
  • Web-specific display setup and extension loading
  • Electron runner communication
  • Display readiness management

This method is called by ClayEvents and should not be called directly.


clay
configureOrientation(): Void

Configures screen orientation for mobile devices (SDL platforms only).

This function converts Ceramic's orientation settings into SDL hints to control which orientations are allowed on mobile platforms.

Supported orientations:

  • Portrait (upright)
  • Portrait upside down
  • Landscape left
  • Landscape right

Multiple orientations can be combined using bitwise OR operations.