Skip to content

Provide convenience API for removing all markers #17

@cpetrov

Description

@cpetrov

Currently, marker.dispose() removes the marker from the map.getMarkers() array. Something like:

map.getMarkers().forEach(marker => marker.dispose());

... would not work, since the array would be modified by marker.dispose(). In this case one needs to use a reverse for loop, which is not very convenient:

let markers = map.getMarkers();
for (let i = markers.length - 1; i >= 0; i--) {
  markers[i].dispose();
}

I suggest offering a type for the markers collection similar to WidgetCollection, which allows disposing (e.g. map.getMarkers().dispose()) and configuring all markers at once.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions