Reading entities
The Felt SDK provides several methods for reading data from your map's entities (layers, elements, etc.) and staying in sync with their changes. This guide will show you how to read entity data and react to changes.
Getting entities
The Felt SDK provides both singular and plural versions of getter methods for various entity types. This allows you to retrieve either a single entity or multiple entities of the same type.
For example, for layers:
Using constraints
All of the methods that return multiple entities accept constraint parameters to filter the results:
Reacting to changes
To stay in sync with entities, use the appropriate on[EntityType]Change
method. For example, to monitor layer changes:
Best practices
Cleanup: Always store and call the unsubscribe functions when you're done listening for changes so that the listener doesn't continue to run in the background.
Error handling: When getting entities, remember that the methods may return
null
if the entity doesn't exist:
Batch operations: When you need multiple entities, use the bulk methods (
getLayers
,getElements
, etc.) with constraints rather than making multiple individual calls:
This approach to reading and monitoring entities gives you full control over your map's data and allows you to build interactive applications that stay in sync with the map's state.
Last updated