View on GitHub

leaflet-city-mapper

A small 3D rendering engine for leaflet

Shared globals

Source guide Project README

Holds shared constants, reusable buffers and descriptors, queues and mutable holders. Each module owns a single shared binding; callers should respect whether its contents are reusable mutable scratch state or an immutable constant.

Shared is not per-layer

flowchart LR
  Globals["Shared module bindings"] --> Constants["Constants / saved methods"]
  Globals --> Scratch["Reusable arrays / descriptors"]
  Globals --> Queues["Shared queues / mutable holders"]
  Queues --> Frames["Coalesced scene frames"]
  Objects["Map / layer / mesh"] --> WeakMaps["Per-object WeakMaps"]

Scratch values are reused: do not retain them as private layer state. Clear temporary resource references as existing consumers do. Per-object lifetime belongs in weakmaps.

Related: weakmaps, scene.