ReadonlyversionVersion of the recorder, written into every recording.
Whether the recorder is currently capturing calls.
Whether every entry is printed to the console as it is recorded. The RecorderOptions.logCalls option sets the same thing up front; this turns it on and off in the middle of a session.
The operations recorded so far.
Patches a MapLibre namespace and starts recording. Call this before the application creates any map.
Optionalnamespace: any
the MapLibre namespace. It has to be writable, because
the constructors are replaced on it: pass {...maplibre} rather than the
module namespace itself, and have the application use that same copy.
Defaults to window.maplibregl.
Optionaloptions: RecorderOptions
recorder options
the recorder, for chaining
Fallback for applications that bundle MapLibre and do not expose the
namespace. Only Map calls are captured - marker and popup calls are not,
because their classes cannot be reached from a map instance.
a live Map instance
Optionaloptions: RecorderOptions
recorder options
the recorder, for chaining
Discards everything recorded so far and restarts the clock.
Notes what is on screen right now, at this point in the timeline.
A recording is a few hundred calls with no indication of which one matters. A mark becomes a comment at exactly this place in the exported script, so whoever reads the reproduction knows which line to look at. It is an annotation and never a call - nothing else about the recording changes.
what is on screen right now, e.g. 'markers are oversized'
the recorder, for chaining
Subscribes to state changes - a call recorded, recording paused, the timeline cleared. This is how a front end such as RecorderControl follows the recorder without the recorder knowing anything about it.
called after every change
a function that removes the listener
Prints everything recorded so far to the console, one line per entry, so what has been captured can be read without exporting anything.
The calls MapLibre made into itself are indented under the call that
caused them and marked with ↳. They never reach the exported script, so
this is the only place they show up - marker.addTo(map) is one line, and
the remove and setDraggable MapLibre reaches it through sit under it.
the recorder, for chaining
Resumes recording.
Pauses recording. Patches stay in place, so recording can be resumed.
The raw recording.
Records every call an application makes into MapLibre GL JS, as a timeline that
emitScriptwrites back out as the JavaScript that would make them.This is the engine and nothing else: it has no user interface and touches no files. The panel that drives it is RecorderControl, a MapLibre control that uses this class through its public API.
Most of the time you want the shared MaplibreRecorder instance rather than one of your own.
Example