AppActivationContext
class AppActivationContext
extends
ManagedObject
Represents the application state using a single ‘target’ path in URL format. Used by AppActivity
classes to implement routing behavior. This class is overridden by specialized implementations to work with platform features, e.g. DOM navigation in a Web browser.
Note: An instance of this object is provided by the Application
object (e.g. BrowserApplication
), and is also available on all activities and views as activationContext
.
Constructor
(): AppActivationContext
.target
string
The current full target path, in URL format without leading or trailing slashes (e.g. foo/bar/123
), defaults to the empty string. Changes to this property automatically result in a change event being emitted on the activation context instance itself.
.navigate()
(_path: string): void
Navigate to given (relative) path, in URL format or :back
to go back in history; to be overridden, the base implementation does nothing.
.match()
(path: string, activity?:
AppActivity
):
MatchedPath
path
— The activity path to match, without leading slashes (e.g.foo/bar
). Paths with a trailing slash (e.g.foo/bar/
) match the exact path as well as sub paths. Paths may contain partial captures as either:foo
or*foo
, matching a single segment without slashes and the full remainder of the target path, respectively - but not an empty segment. The prefix.
/
is replaced with the path (string) of the closest parent activity that has aAppActivity.path
string property.
activity
— The activity that is used to search for parent activities if necessary.
Check if given activity path matches the current target path.
Returns: An object with properties for all partial captures if given path matches the current target, or undefined otherwise.
.managedId
number
Inherited from ManagedObject.managedId
.
.managedState
Inherited from ManagedObject.managedState
.
.getReferenceCount() protected
(): number
Inherited from ManagedObject.getReferenceCount
.
.getManagedReferrers() protected
():
ManagedObject
[]
Inherited from ManagedObject.getManagedReferrers
.
.getManagedParent() protected
<TParent extends ManagedObject = 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
.
.emitChange()
(name?: string): void
Inherited from ManagedObject.emitChange
.
.propagateChildEvents() protected deprecated
(...types: ((new (...args: any[]) =>
ManagedEvent
) | ((e:
ManagedEvent
) => any))[]): 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
.
AppActivationContext.MatchedPath
Captured path segments, matched by AppActivationContext.match
.
.path
string
The full path that was matched.