Managed reference objects encapsulate stand-alone references to other managed objects.

class ManagedReference

extends ManagedObject

Independent reference to a managed object, list, map, or other managed reference. An instance of this class behaves in the same way as a managed reference property of an instance of ManagedObject.


<T extends ManagedObject = ManagedObject>(target?: T): ManagedReference<T>


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

[1] Propagate events from referenced objects by emitting the same events on the ManagedReference instance itself.

If a function is specified, the function can be used to transform one event to one or more others, or stop propagation if the function returns undefined. The function is called with the event itself as its only argument.

[2] Propagate events from referenced objects by emitting the same events on the ManagedReference instance itself.

If one or more event classes are specified, only events that extend given event types are propagated.

Note: Calling this method a second time replaces the current propagation rule/function.


<T extends ManagedObject>(classType: ManagedObjectConstructor<T>): ManagedReference<T>

Ensure that referenced objects are instances of given class (or a sub class), both the current value and any new references set. Given class must be a sub class of ManagedObject.


(): T

Returns the referenced object, or undefined if none.


(): this

Remove the current reference, if any.


(target?: T): this

Set the current reference to given object, or managed list, map, or another reference. Equivalent to setting the target property on this instance.


(): this

Stop newly referenced objects from becoming child objects even if this ManagedReference instance itself is held through a child reference (by a parent object); this can be used to automatically dereference objects when the parent object is destroyed.


(): { $ref: number; }

Returns the referenced object itself, or undefined (alias of get() method).



Inherited from ManagedObject.managedId.



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.


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

Inherited from ManagedObject.emit.


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