Observable
The `observable` class provides Publish&Subscribe functionality for `map` and `map snapshotter` objects. The dedicated methods return a cancellable object whose `cancel` method can be used to cancel an active subscription.
``` text
Simplified diagram for events emitted by the map object.
┌─────────────┐ ┌─────────┐ ┌──────────────┐
│ Application │ │ Map │ │ResourceLoader│
└──────┬──────┘ └────┬────┘ └───────┬──────┘
│ │ │
├───────setStyleURI────────▶│ │
│ ├───────────get style───────────▶│
│ │ │
│ │◀─────────style data────────────┤
│ │ │
│ ├─parse style─┐ │
│ │ │ │
│ StyleDataLoaded ◀─────────────┘ │
│◀───────type: Style────────┤ │
│ ├─────────get sprite────────────▶│
│ │ │
│ │◀────────sprite data────────────┤
│ │ │
│ ├──────parse sprite───────┐ │
│ │ │ │
│ StyleDataLoaded ◀─────────────────────────┘ │
│◀──────type: Sprite────────┤ │
│ ├─────get source TileJSON(s)────▶│
│ │ │
│ SourceDataLoaded │◀─────parse TileJSON data───────┤
│◀─────type: Metadata───────┤ │
│ │ │
│ │ │
│ StyleDataLoaded │ │
│◀──────type: Sources───────┤ │
│ ├──────────get tiles────────────▶│
│ │ │
│◀───────StyleLoaded────────┤ │
│ │ │
│ SourceDataLoaded │◀─────────tile data─────────────┤
│◀───────type: Tile─────────┤ │
│ │ │
│ │ │
│◀────RenderFrameStarted────┤ │
│ ├─────render─────┐ │
│ │ │ │
│ ◀────────────────┘ │
│◀───RenderFrameFinished────┤ │
│ ├──render, all tiles loaded──┐ │
│ │ │ │
│ ◀────────────────────────────┘ │
│◀────PerfStatsCollected────┤ │
│ │ │
│ │ │
│◀────────MapLoaded─────────┤ │
│ │ │
│ │ │
│◀─────────MapIdle──────────┤ │
│ ┌ ─── ─┴─ ─── ┐ │
│ │ offline │ │
│ └ ─── ─┬─ ─── ┘ │
│ │ │
├─────────setCamera────────▶│ │
│ ├───────────get tiles───────────▶│
│ │ │
│ │┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │
│◀─────────MapIdle──────────┤ waiting for connectivity │ │
│ ││ Map renders cached data │
│ │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ │
│ │ │
```
Content copied to clipboard
Functions
Link copied to clipboard
Subscribes to `CameraChanged` event.
Subscribes to `MapIdle` event.
Subscribes to `MapLoaded` event.
Subscribes to `MapLoadingError` event.
Subscribes to `PerfStatsCollected` event.
Subscribes to `RenderFrameFinished` event.
Subscribes to `RenderFrameStarted` event.
Subscribes to `ResourceRequest` event.
Subscribes to `SourceAdded` event.
Subscribes to `SourceDataLoaded` event.
Subscribes to `SourceRemoved` event.
Subscribes to `StyleDataLoaded` event.
Subscribes to `StyleImageMissing` event.
Subscribes to `StyleImageRemoveUnused` event.
Subscribes to `StyleLoaded` event.
Subscribes to an experimental `GenericEvent` event.