Skip to content

@modoki/engine / index / entityRef

Function: entityRef()

entityRef(entity): string | number

Stable journal/Percept reference for an entity: its GUID when it has one (survives scene hot-reloads), else its current numeric id as a fallback for an un-guidable (fresh, unsaved) entity. Call this on entities before emitting them in a payload — a raw entity is a primitive number the journal cannot safely auto-detect.

Parameters

entity

EntityLike

Returns

string | number

Built with Modoki.