Application

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.

Constructor

(): 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

ManagedList<Application>

All Application instances that are currently active.

.name

string

The application name.

.activities

AppActivityList

List of root activities, as child components.

.renderContext

UIRenderContext

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

.activationContext

AppActivationContext

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

.activate()

(): 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.

.activateAsync()

(): Promise<void>

Activate this application, immediately creating all primary activities.

.deactivateAsync()

(): Promise<void>

Deactivate this application, immediately destroying all actvities.

.destroyAsync()

(): Promise<void>

Destroy this application, immediately destroying all activities.

.navigate()

(path: string): this

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

.add()

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

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

.showViewActivityAsync()

<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.

.getParentComponent()

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

Inherited from Component.getParentComponent.

.getCompositeParent()

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

Inherited from Component.getCompositeParent.

.propagateComponentEvent()

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

Inherited from Component.propagateComponentEvent.

.managedId

number

Inherited from ManagedObject.managedId.

.managedState

ManagedState

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.

.emit()

<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

Application presets type, for use with Component.with.

.name

string

Human readable application name.

.renderContext

UIRenderContext

Platform dependent application render context.

.activationContext

AppActivationContext

Platform dependent activation context (router).