Skip to main content

Base

The Base class is used by objects that don't extend the Evented class.

class MyThing extends Base {}
info

This is used internally and in plugins. It is not intended to be used to display objects on the map.

Methods

getObjectType

getObjectType(): string

Each object in the library has a specific type. This gets that value.

For example, the Map object has a type of map. And the Marker object has a type of marker.

You can use this if you need to test what type of object you're working with.

if (thing.getObjectType() === 'marker') {
// Do something
}

include

static include(mixin: object)

This allows you to include a mixin into a class.

ParameterTypeRequiredDescription
mixinobjectYesThe object to merge into this object.
Base.include({
someFunction() {}
})

isIcon

isIcon(): boolean

Returns whether the object is an Icon object.

This is a simpler test than using getObjectType.

if (thing.isIcon()) {
// Do something
}

isInfoWindow

isInfoWindow(): boolean

Returns whether the object is an InfoWindow object.

This is a simpler test than using getObjectType.

if (thing.isInfoWindow()) {
// Do something
}

isLatLng

isLatLng(): boolean

Returns whether the object is a LatLng object.

This is a simpler test than using getObjectType.

if (thing.isLatLng()) {
// Do something
}

isLatLngBounds

isLatLngBounds(): boolean

Returns whether the object is a LatLngBounds object.

This is a simpler test than using getObjectType.

if (thing.isLatLngBounds()) {
// Do something
}

isMap

isMap(): boolean

Returns whether the object is a Map object.

This is a simpler test than using getObjectType.

if (thing.isMap()) {
// Do something
}

isMarker

isMarker(): boolean

Returns whether the object is a Marker object.

This is a simpler test than using getObjectType.

if (thing.isMarker()) {
// Do something
}

isMarkerCluster

isMarkerCluster(): boolean

Returns whether the object is a MarkerCluster object.

This is a simpler test than using getObjectType.

if (thing.isMarkerCluster()) {
// Do something
}

isPoint

isPoint(): boolean

Returns whether the object is a Point object.

This is a simpler test than using getObjectType.

if (thing.isPoint()) {
// Do something
}

isPolyline

isPolyline(): boolean

Returns whether the object is a Polyline object.

This is a simpler test than using getObjectType.

if (thing.isPolyline()) {
// Do something
}

isPopup

isPopup(): boolean

Returns whether the object is a Popup object.

This is a simpler test than using getObjectType.

if (thing.isPopup()) {
// Do something
}

isSize

isSize(): boolean

Returns whether the object is a Size object.

This is a simpler test than using getObjectType.

if (thing.isSize()) {
// Do something
}

isSvgSymbol

isSvgSymbol(): boolean

Returns whether the object is a SvgSymbol object.

This is a simpler test than using getObjectType.

if (thing.isSvgSymbol()) {
// Do something
}