ManagedRecord
class ManagedRecord
extends
Component
Managed record base class. Represents data that is managed (as ManagedObject
), with additional methods to managed inward references — especially useful for constructing the application model.
Constructor
(): ManagedRecord
.create() static
<T extends object, TResult extends ManagedRecord>(this: new () => TResult, properties?: T): TResult & { [p in keyof T]: T[p]; }
Create a new instance of this class (a sub class of ManagedRecord
), and copy given properties.
.serialize()
(): any
Serialize this record as a regular object, including all string, number, boolean, and undefined property values (except for properties that start with an underscore, and managedId
). Also calls serialize
on all child records (including those within lists and maps, but not regular arrays or objects, nor managed objects that are not referenced as child records).
.getParentRecord()
<TParent extends ManagedRecord = ManagedRecord>(ParentClass?:
ManagedRecordConstructor
<TParent>): TParent
Returns the parent record (or parent’s parent, etc.). If a class reference is specified, finds the nearest parent of given type. See @managedChild
and @component
decorators.
.getNextSibling()
<TResult = this>(): TResult
Returns the next record in a parent list (i.e. a list that is a child object of another record).
.getPreviousSibling()
<TResult = this>(): TResult
Returns the previous record in a parent list (i.e. a list that is a child object of another record).
.getReferrerRecords()
<TResult extends ManagedRecord = ManagedRecord>(FilterByClass?:
ManagedRecordConstructor
<TResult>): TResult[]
FilterByClass
— If specified, results will only include instances of given class. Other referrers are not inspected recursively.
Returns an array of unique records that contain managed references to this object (see @managed
, @managedChild
, and @component
). This includes records that refer directly to this object, as well as those that refer to managed list(s) or map(s) that contain this record.
.isPresetComponent() protected
(): boolean
Inherited from Component.isPresetComponent
.
.delegateEvent() protected
(e:
ManagedEvent
, propertyName: string): boolean | void
Inherited from Component.delegateEvent
.
.getParentComponent()
<TParent extends Component = Component>(ParentClass?:
ComponentConstructor
<TParent>): TParent
Inherited from Component.getParentComponent
.
.getBoundParentComponent()
<TParent extends Component>(ParentClass?:
ComponentConstructor
<TParent>): TParent
Inherited from Component.getBoundParentComponent
.
.emitAction()
(name: string, inner?:
ManagedEvent
, context?:
ManagedObject
): void
Inherited from Component.emitAction
.
.propagateComponentEvent() deprecated
(name: string, inner?:
ManagedEvent
): void
Inherited from Component.propagateComponentEvent
.
.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
.