To visualize features on the map, a FeatureLayer
queries a subset of the features from the layers model.
This feature subset, which possibly contains all features, is the WorkingSet
of the feature layer.
You can access it through the workingSet
property.
Each feature layer has a single WorkingSet
instance.
The contents of the working set can vary over time.
Applications can receive notification of changes to the working set through the WorkingSetChanged
event.
Working set instances also emit events when queries on the underlying model are in progress.
QueryStarted
and QueryFinished
events signal the beginning and end of a query.
The working sets emit those events regardless of the success or failure of the query.
If the query was executed successfully, they emit a QuerySuccess
event.
Otherwise, they emit a QueryError
event.
A working set is mutable: you can add, update, and remove Features
from the WorkingSet
.
These changes propagate through to the underlying FeatureModel
.
Modifying the contents of a model though the working set of a layer has a benefit: the returned promises don’t resolve until
the WorkingSet
fires the corresponding WorkingSetChanged
event.
This is useful because the WorkingSetChanged
event indicates that the add, remove, or update operation is completed in the model and that the result is correctly visualized
on the layer.