Skip to content

@modoki/engine / index / markPersistent

Function: markPersistent() ​

markPersistent(entity, guid?): string

Mark a root entity as persistent. Throws if the entity is not a root (parentId !== 0 or no EntityAttributes). Assigns a fresh UUID to EntityAttributes.guid if the entity doesn't already have one. Returns the guid that ended up on the entity.

Uses the trait registry to look up EntityAttributes so this works in tests where the trait registry is mocked with test-local traits.

Parameters ​

entity ​

Entity

guid? ​

string

Returns ​

string

Built with Modoki.