Call
Declaratively invokes a method on the map instance.
The method runs again on each revalidation in which consumed tracked state changed, even when the argument values are the same. Glimmer propagates by tag, not by value, so (array) and (hash) build a new object after any upstream change. A stable reference does not prevent this, and neither does @cached.
A repeat call restarts an animation. For fitBounds, flyTo and easeTo, keep the last arguments. If they do not change, return early.
Example
<MapLibreGL @initOptions={{this.mapOptions}} as |map|>
<map.call @func="flyTo" @positionalArguments={{array (hash center=this.target zoom=14)}} />
</MapLibreGL>Import
Yielded by <MapLibreGL> as map.call — no import needed.
Direct import (rare)
import MapLibreGLCall from 'ember-maplibre-gl/components/maplibre-gl-call';Signature
interface MapLibreGLCallSignature {
Args: {
/** The object to call the method on — typically the map instance (pre-bound by parent). */
obj: MapInstance;
/** Name of the method to invoke (e.g. "flyTo", "setStyle", "resize"). */
func: keyof MapInstance;
/** Arguments to pass to the method. */
positionalArguments: unknown[];
/** Optional callback that receives the method's return value. */
onResp?: (result: unknown) => void;
};
}Args
| Arg | Type | Required | Description |
|---|---|---|---|
func | keyof MapInstance | Yes | Name of the method to invoke (e.g. "flyTo", "setStyle", "resize"). |
positionalArguments | unknown[] | Yes | Arguments to pass to the method. |
onResp | Function | No | Optional callback that receives the method's return value. |
MapInstance
Public function method surface of the MapLibre Map ↗. Excludes _-prefixed internals and non-method properties so @func only auto-completes callable public methods.
type MapInstance = Pick<MaplibreMap, PublicMethodKeys<MaplibreMap>>Demo
This map calls fitBounds on load to fit the view to a bounding box.
import MapLibreGL from 'ember-maplibre-gl/components/maplibre-gl';
const options = {
style: 'https://tiles.openfreemap.org/styles/bright',
center: [0, 0],
zoom: 1,
};
const bounds = [[-125, 24], [-66, 50]];
<template>
<MapLibreGL @initOptions={{options}} style="height: 300px; width: 100%; border-radius: 8px;" as |map|>
<map.call @func="fitBounds" @positionalArguments={{array bounds (hash padding=40)}} />
</MapLibreGL>
</template>