getLayer
Searches for a layer with the given name, passes it to the optional callback function (if provided), and returns it. This will search both polygon and marker layers at once.
Parameters:
name
(string): the name of the layer to search forcallback
(function): (OPTIONAL) A callback function to execute. It will be passed the layer found, which may benull
if no layer matchesname
.
Returns: A promise that resolves to layer
(object): The layer matching name
, or null
if no layer matches name
.