Markupless Documentation - v0.4.3
    Preparing search index...

    Class App

    The core application class for the Markupless framework. Orchestrates the rendering, routing, state management, and plugin integration.

    Index

    Constructors

    • Creates a new App instance.

      Parameters

      • Optionaltarget: string

        The CSS selector for the root element (e.g., "#app").

      Returns App

    Properties

    _actions: any = {}

    Internal actions holder (deprecated/legacy usage)

    _state: any = null

    Internal state holder (deprecated/legacy usage)

    components: BaseElement[] = []

    List of components registered to the app (for non-routed apps)

    configOptions: { title?: string } = {}

    Configuration options

    plugins: Set<string> = ...

    Set of installed plugin names to prevent duplicates

    root: HTMLElement | null = null

    Reference to the root DOM element where the app is mounted

    router: Router = ...

    The router instance handling client-side navigation

    Accessors

    • get isBrowser(): boolean

      Checks if the code is running in a browser environment.

      Returns boolean

    Methods

    • Adds a component or list of components to the application. Used primarily when no routing is defined.

      Parameters

      Returns this

      The App instance for chaining.

      app().add(div("Hello"));
      
    • Injects a global CSS style string into the document head.

      Parameters

      • style: string

        The CSS string to inject.

      Returns this

      The App instance for chaining.

    • Configures global application settings.

      Parameters

      • options: { title?: string }

        Configuration object (e.g., { title: "My App" }).

      Returns this

      The App instance for chaining.

      app().config({ title: "My Awesome App" });
      
    • Defines application logic (deprecated pattern).

      Parameters

      • logicFn: (state: any, actions: any) => any

        Function receiving state and actions.

      Returns this

      The App instance for chaining.

    • Renders the application to the DOM. Must be called after configuration and setup.

      Returns App

      The App instance.

      Error if run outside the browser or if root element is missing.

    • Renders the application to a string (Server-Side Rendering).

      Returns string

      The HTML string representation of the app.

    • Registers a route handler for a specific path.

      Parameters

      • path: string

        The URL path (e.g., "/home").

      • handler: RouteHandler

        A BaseElement or a factory function returning one.

      Returns this

      The App instance for chaining.

      app().route("/", () => div("Home Page"));
      
    • Sets the document title.

      Parameters

      • title: string

        The new title string.

      Returns this

      The App instance for chaining.

    • Creates a reactive state object (legacy wrapper around state()).

      Type Parameters

      • T

      Parameters

      • initialState: T

        The initial value.

      Returns State<T>

      A reactive state proxy.

    • Installs a plugin into the application.

      Parameters

      • plugin: Plugin

        The plugin object implementing the Plugin interface.

      Returns this

      The App instance for chaining.