or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

application-engine.mdcomponents.mdcontrollers.mddata-structures.mddebugging-development.mddestroyables-cleanup.mdindex.mdmodifiers.mdobject-model.mdreactivity-tracking.mdrouting.mdservices.mdtemplates-rendering.mdtesting.mdutilities.md
tile.json

application-engine.mddocs/

Application & Engine System

Core application lifecycle management and mountable engine architecture for building large-scale applications with multiple teams.

Capabilities

Application Class

The main application class that manages the entire Ember.js application lifecycle.

/**
 * Main application class that manages the entire Ember.js application lifecycle
 */
class Application {
  /**
   * Create a new application instance
   * @param options - Configuration options for the application
   * @returns New Application instance
   */
  static create(options?: ApplicationOptions): Application;
  
  /**
   * Build an application instance for rendering
   * @returns Promise resolving to ApplicationInstance
   */
  buildInstance(): Promise<ApplicationInstance>;
  
  /**
   * Boot the application and start rendering
   * @returns Promise resolving to the Application
   */
  boot(): Promise<Application>;
  
  /**
   * Visit a URL for server-side rendering
   * @param url - URL to visit
   * @returns Promise resolving to ApplicationInstance
   */
  visit(url: string): Promise<ApplicationInstance>;
  
  /**
   * Defer application readiness until advanceReadiness() is called
   */
  deferReadiness(): void;
  
  /**
   * Advance application readiness after deferReadiness()
   */
  advanceReadiness(): void;
  
  /**
   * Reset the application to its initial state (globals mode only)
   */
  reset(): void;
}

Usage Examples:

import Application from "@ember/application";

// Create and configure application
const App = Application.create({
  rootElement: '#my-app',
  autoboot: false
});

// Defer boot until ready
App.deferReadiness();

// Load some async data then boot
loadCriticalData().then(() => {
  App.advanceReadiness();
});

// Server-side rendering
const instance = await App.visit('/users/123');
const html = instance.getHTML();

ApplicationInstance Class

Runtime instance of an application with access to the dependency injection container.

/**
 * Runtime instance of an application with access to the dependency injection container
 */
class ApplicationInstance {
  /**
   * Boot the application instance
   * @returns Promise resolving when boot is complete
   */
  boot(): Promise<void>;
  
  /**
   * Destroy the application instance and clean up resources
   * @returns Promise resolving when destruction is complete
   */
  destroy(): Promise<void>;
  
  /**
   * Get HTML output for server-side rendering
   * @returns HTML string representation
   */
  getHTML(): string;
}

Engine Class

Mountable engine base class for building modular applications.

/**
 * Mountable engine base class for building modular applications
 */
class Engine {
  /**
   * Create a new engine
   * @param properties - Engine configuration properties
   * @returns New Engine class
   */
  static extend(properties?: object): typeof Engine;
  
  /**
   * Build an engine instance
   * @returns Promise resolving to EngineInstance
   */
  buildInstance(): Promise<EngineInstance>;
}

EngineInstance Class

Runtime instance of an engine.

/**
 * Runtime instance of an engine
 */
class EngineInstance {
  /**
   * Boot the engine instance
   * @returns Promise resolving when boot is complete
   */
  boot(): Promise<void>;
  
  /**
   * Destroy the engine instance
   * @returns Promise resolving when destruction is complete
   */
  destroy(): Promise<void>;
}

Namespace Management

Global namespace management for organizing application components.

/**
 * Global namespace management for organizing application components
 */
class Namespace {
  /**
   * Create a new namespace
   * @param properties - Namespace properties
   * @returns New Namespace instance
   */
  static create(properties?: object): Namespace;
}

Owner System

Dependency injection container access for retrieving services and managing object lifecycle.

/**
 * Get the owner (DI container) for an object
 * @param object - Object to get owner for
 * @returns Owner instance or undefined
 */
function getOwner(object: any): Owner | undefined;

/**
 * Set the owner (DI container) for an object
 * @param object - Object to set owner on
 * @param owner - Owner instance to set
 */
function setOwner(object: any, owner: Owner): void;

Lazy Loading Hooks

Hook system for registering callbacks that execute when modules are loaded.

/**
 * Register a callback to execute when a named module is loaded
 * @param name - Module name to watch for
 * @param callback - Function to execute when module loads
 */
function onLoad(name: string, callback: (object: any) => void): void;

/**
 * Execute all registered callbacks for a named module
 * @param name - Module name to run hooks for
 * @param object - Object to pass to callbacks
 */
function runLoadHooks(name: string, object: any): void;

Usage Examples:

import { onLoad, runLoadHooks } from "@ember/application";

// Register a hook to run when Ember Data loads
onLoad('Ember.Application', function(app) {
  app.inject('route', 'store', 'service:store');
});

// Later, when the application is created
runLoadHooks('Ember.Application', myApp);

Types

interface ApplicationOptions {
  /** Root element selector or DOM element */
  rootElement?: string | Element;
  /** Whether to automatically boot the application */
  autoboot?: boolean;
  /** Application name */
  name?: string;
  /** Custom resolver */
  Resolver?: any;
}

interface Owner {
  /** Look up a registered factory or instance */
  lookup(fullName: string): any;
  /** Register a factory */
  register(fullName: string, factory: any, options?: RegisterOptions): void;
  /** Get factory for a full name */
  factoryFor(fullName: string): Factory | undefined;
  /** Check if a factory is registered */
  hasRegistration(fullName: string): boolean;
  /** Unregister a factory */
  unregister(fullName: string): void;
}

interface Factory {
  /** Create an instance from the factory */
  create(options?: object): any;
  /** Factory class */
  class: any;
}

interface RegisterOptions {
  /** Make this a singleton */
  singleton?: boolean;
  /** Instantiate immediately */
  instantiate?: boolean;
}