MMapGroupEntity
The GroupEntity
entity is similar to ComplexEntity
, but the addChild
and removeChild
methods, as well as the children
property, are public.
The mappable module has the abstract MMapGroupEntity
class to create custom entities of the GroupEntity
type using inheritance:
type MMapSomeGroupEntityProps = {
name?: string;
};
class MMapSomeGroupEntity extends mappable.MMapGroupEntity<MMapSomeGroupEntityProps> {
// ...
}
const groupEntity = new MMapSomeGroupEntity();
const someEntity = new MMapSomeEntity(); // MMapSomeEntity is inherited from MMapEntity.
// Adding an external entity from the subtree via a public method.
groupEntity.addChild(someEntity);
// Removing an external entity from athesubtree via a public method.
groupEntity.removeChild(someEntity);