Base
The Base class is used by objects that don't extend the Evented class.
class MyThing extends Base {}
This is used internally and in plugins. It is not intended to be used to display objects on the map.
Methods
constructor
constructor(objectType: string)
The class object constructor.
| Parameter | Type | Required | Description |
|---|---|---|---|
| objectType | string | Yes | The object type. i.e. "latlng", "point", "size". Used with getObjectType and the object type tests below. |
class MyThing extends Base {
constructor() {
super('mything');
}
}
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.
| Parameter | Type | Required | Description |
|---|---|---|---|
| mixin | object | Yes | The 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
}