class Application

extends Component

Represents the application itself, encapsulates activities (AppActivity components) and contexts for rendering and activation using URL-like paths.

Use the static run method to create and activate an application using a set of activity constructors, or create an application class that includes activities as sub components (properties decorated using the @compose decorator). For a manually created class, an instance must be created and activated (see activate) for the application to start.

Note: Do not use the Application class directly, as it will not initialize rendering or activation contexts. Instead, use platform specific application classes such as BrowserApplication that is exported by the @typescene/webapp package.


(): Application

.run() static

<T extends Application>(this: typeof Application & (new () => T), ...activities: (ComponentConstructor<Component> & (new () => AppActivity))[]): T

Create an application that includes given activities, and start it immediately.

Returns: the application instance.

Note: Calling this method directly on Application creates an application without any context (i.e. activationContext and renderContext). Instead, use a constructor that is meant for a specific platform (e.g. BrowserApplication).

.active static


All Application instances that are currently active.



The application name.



List of root activities, as child components.



Application render context as a managed child object, propagated to all (nested) AppComponent instances.



Activity activation context as a managed child object, propagated to all (nested) AppComponent instances.


(): this

Activate this application asynchronously, immediately creating all primary activities; any errors during activation are handled by logging them to the console (uses UnhandledErrorEmitter).

Returns: the application itself.


(): Promise<void>

Activate this application, immediately creating all primary activities.


(): Promise<void>

Deactivate this application, immediately destroying all actvities.


(): Promise<void>

Destroy this application, immediately destroying all activities.


(path: string): this

Navigate to given (relative) path, or go back in history if argument is :back, using the current Application.activationContext.


(...activities: AppActivity[]): this

Add given activities to the application. Activities with matching paths will be activated immediately (see AppActivity.path).


<TViewActivity extends AppActivity & { render: Function; }>(viewActivity: TViewActivity): Promise<TViewActivity>

Add given view activity to the application, and activate it immediately regardless of AppActivity.path; this causes corresponding views to be rendered if possible.

Returns: A promise that resolves to the view activity after it has been activated.

.isPresetComponent() protected

(): boolean

Inherited from Component.isPresetComponent.


[1]. (): Component
[2]. <TParent extends Component>(ParentClass: ComponentConstructor<TParent>): TParent

Inherited from Component.getParentComponent.


<TParent extends Component>(ParentClass?: ComponentConstructor<TParent>): TParent

Inherited from Component.getCompositeParent.


(name: string, inner?: ManagedEvent): void

Inherited from Component.propagateComponentEvent.



Inherited from ManagedObject.managedId.



Inherited from ManagedObject.managedState.

.getReferenceCount() protected

(): number

Inherited from ManagedObject.getReferenceCount.

.getManagedReferrers() protected

(): ManagedObject[]

Inherited from ManagedObject.getManagedReferrers.

.getManagedParent() protected

[1]. (): ManagedObject
[2]. <TParent extends ManagedObject>(ParentClass: ManagedObjectConstructor<TParent>): TParent

Inherited from ManagedObject.getManagedParent.


<TEvent extends ManagedEvent = ManagedEvent, TConstructorArgs extends any[] = any[]>(e: string | TEvent | (new (...args: TConstructorArgs) => TEvent), ...constructorArgs: TConstructorArgs): this

Inherited from ManagedObject.emit.

.propagateChildEvents() protected

[1]. (f?: (this: this, e: ManagedEvent, propertyName: string) => void | ManagedEvent | ManagedEvent[]): this
[2]. (...types: (ManagedEvent | (new (...args: any[]) => ManagedEvent))[]): this

Inherited from ManagedObject.propagateChildEvents.

.activateManagedAsync() protected

(): Promise<any>

Inherited from ManagedObject.activateManagedAsync.

.deactivateManagedAsync() protected

(): Promise<void>

Inherited from ManagedObject.deactivateManagedAsync.

.destroyManagedAsync() protected

(): Promise<void>

Inherited from ManagedObject.destroyManagedAsync.

.onManagedStateActivatingAsync() protected

(): Promise<void>

Inherited from ManagedObject.onManagedStateActivatingAsync.

.onManagedStateActiveAsync() protected

(): Promise<void>

Inherited from ManagedObject.onManagedStateActiveAsync.

.onManagedStateDeactivatingAsync() protected

(): Promise<void>

Inherited from ManagedObject.onManagedStateDeactivatingAsync.

.onManagedStateInactiveAsync() protected

(): Promise<void>

Inherited from ManagedObject.onManagedStateInactiveAsync.

.onManagedStateDestroyingAsync() protected

(): Promise<void>

Inherited from ManagedObject.onManagedStateDestroyingAsync.


Application presets type, for use with Component.with.



Human readable application name.



Platform dependent application render context.



Platform dependent activation context (router).