Docs (4.0.0)
Data structures

class ManagedRecord

A class that can be used to describe data models based on ManagedObject.

class ManagedRecord
extends ManagedObject

Description

For the most part, ManagedRecord objects behave exactly like ManagedObject instances. The ManagedRecord class only adds two features on top of the functionality offered by ManagedObject:

  • A static create() method, which constructs a new instance (without any arguments), and then applies a given set of properties.
  • Methods for finding parent records (instances of ManagedRecord), and siblings in a ManagedList.

Example

// Create a ManagedRecord that holds other records
class MyItem extends ManagedRecord {
  name = "";
  readonly list = this.attach(new MangedList<MyItem>());
}

let item = MyItem.create({ name: "root" });
item.list.add(
  MyItem.create({ name: "one" }),
  MyItem.create({ name: "two" })
);
item.list.first().name // => "one"
item.list.first().getParentRecord() // => item
item.list.first().getNextSibling()?.name // => "two"

Type Members

Static Members

Instance Members

Inherited Members