Skip to main content

Function: getSnapshotModelId()

function getSnapshotModelId(snapshot): string | undefined;

Gets the model ID from a model snapshot.

This function extracts the model's unique identifier from a snapshot by looking up the model class using $modelType and then reading the value of the ID property (as declared with idProp).

Parameters​

ParameterTypeDescription
snapshotunknownA model snapshot (must have $modelType).

Returns​

string | undefined

The model ID if the snapshot has an ID property, or undefined if not.