Description

Defines the structure of a superpowers service that should be instantiated for each map instance. The service should hold all registered superpowers of a map.

Index

core/modules/map/superpowers/i-superpowers.ts

Methods

Methods

attachToMap
attachToMap(map: IGoogleMap)

Attaches all superpowers to the given map. Any lazy loaded superpowers registered after the call to attachToMap() will automatically attach to it as well.

Parameters:
Name Type Optional Description
map IGoogleMap No

The map to attach the superpowers to.

Returns: void
use
use(type: Type)
Type parameters:
  • T

Extracts a superpower by its type. The superpower must be previously registered using SuperpowersChargerService.charge(). Attempting to use unregistered superpowers will fail with an error.

Parameters:
Name Type Optional Description
type Type<T> No

The type of superpower being extracted.

Returns: T

The extracted superpower instance.

import { Type } from '@angular/core';

import { IGoogleMap  } from '../i-google-map';
import { ISuperpower } from './i-superpower';

/**
 * Defines the structure of a superpowers service that should be instantiated for each map instance.
 * The service should hold all registered superpowers of a map.
 */
export interface ISuperpowers
{
    /**
     * Extracts a superpower by its type. The superpower must be previously registered using `SuperpowersChargerService.charge()`.
     * Attempting to use unregistered superpowers will fail with an error.
     *
     * @template T The type of superpower being extracted.
     * @param {Type<T>} type The type of superpower being extracted.
     * @returns {T} The extracted superpower instance.
     */
    use<T extends ISuperpower>(type: Type<T>): T;
    /**
     * Attaches all superpowers to the given map.
     * Any lazy loaded superpowers registered after the call to `attachToMap()` will automatically attach to it as well.
     *
     * @param {IGoogleMap} map The map to attach the superpowers to.
     */
    attachToMap(map: IGoogleMap): void;
}

results matching ""

    No results matching ""