geospatial-sdk / core/lib / computeMapContextDiff
computeMapContextDiff()
ts
function computeMapContextDiff(nextContext, previousContext): MapContextDiffThe following logic is produced by identifying layers in both context and determining whether they have been added, removed, changed or reordered.
Identifying layers to determine if they have been added/removed/reordered is done like so:
- For layers with an
idproperty, use non-strict equality on it (e.g. '2' and 2 are equivalent); - For layers without
id, compute a hash of their base properties excluding theextrasproperty
Determining whether layers have changed is done like so:
- For layers with an
idproperty, the value of theversionfield is compared; if values are different (using non-strict equality), then the layer is considered to have changed; otherwise it is considered to have remained the same - For layers without
id, a full hash is computed including theextrasproperty; this means that a layer which only had changes in itsextrasobject will not be considered added/removed, but only changed
Parameters
• nextContext: MapContext
• previousContext: MapContext