map.apps Bundle APIs 4.20.0
    Preparing search index...

    Interface MapWidgetRegistration

    Registers map-related components as OSGi services.

    Use the service map-widget.MapWidgetRegistration to inject an instance of this interface.

    interface MapWidgetRegistration {
        register(
            params: {
                map?: Map;
                mapWidget: MapWidget;
                mapWidgetModel?: MapWidgetModel;
            },
        ): void;
        unregister(keepInstances: boolean): void;
    }
    Index

    Methods

    • Register the new default map widget. If one was previously registered, then it is unregistered.

      The following services are registered:

      • map-widget.MapWidgetModel
        • the map widget model provided to interact with the main map
      • map-widget.Map
        • the @arcgis/core/Map part of the MapWidgetModel, provided if only the layer tree should change
      • map-widget.MapWidget
        • the map widget, do not use it directly

      Parameters

      • params: { map?: Map; mapWidget: MapWidget; mapWidgetModel?: MapWidgetModel }

        components to register { map, mapWidgetModel, mapWidget }

      Returns void

      import { InjectedReference } from "apprt-core/InjectedReference";
      import { MapWidgetRegistration } from "map-widget/MapWidgetRegistration";
      import MapWidgetFactory from "map-widget/MapWidgetFactory";

      class MyComponent {
      private _mapregistration: InjectedReference<MapWidgetRegistration>;
      private _mapfactory: InjectedReference<MapWidgetFactory>;

      activate() {
      const mapregistration = this._mapregistration!;
      const mapfactory = this._mapfactory!;
      const map = mapfactory.createMap({...});
      const model = mapfactory.createWidgetModel({map, ...});
      const widget = mapfactory.createWidget({model});
      mapregistration.register({
      map: map,
      mapWidgetModel: model,
      mapWidget: widget
      });
      }
      }
    • Unregister all services.

      Parameters

      • keepInstances: boolean

        suppress the destruction of widgets.

      Returns void