1.0.2 • Published 6 months ago

@types/mapbox__mapbox-gl-traffic v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/mapbox__mapbox-gl-traffic

Summary

This package contains type definitions for @mapbox/mapbox-gl-traffic (https://github.com/mapbox/mapbox-gl-traffic).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mapbox__mapbox-gl-traffic.

index.d.ts

// Type definitions for @mapbox/mapbox-gl-traffic 1.0
// Project: https://github.com/mapbox/mapbox-gl-traffic
// Definitions by: Niek van Bennekom <https://github.com/niekvb>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/// <reference types="mapbox-gl" />
/// <reference types="node" />

export as namespace MapboxTraffic;
export = MapboxTraffic;

declare class MapboxTraffic {
    /**
     * Create a new [Mapbox GL JS plugin](https://www.mapbox.com/blog/build-mapbox-gl-js-plugins/) that allows you to hide and show
     * traffic layers in your map and an optional toggle button.
     *
     * @param options - Options to configure the plugin.
     */
    constructor(options?: MapboxTraffic.Options);
    _hasTraffic(): boolean;
    _hideTraffic(): void;
    _showTraffic(): void;
    onAdd(map: mapboxgl.Map): HTMLDivElement;
    onRemove(): void;
    render(): void;
    /**
     * Toggle visibility of traffic layer.
     */
    toggleTraffic(): void;
}

declare namespace MapboxTraffic {
    /** Options to configure the `MapboxTraffic` plugin. */
    interface Options {
        /**
         * Show or hide traffic overlay by default.
         *
         * @default false
         */
        showTraffic?: boolean;
        /**
         * Show a toggle button to turn traffic on and off.
         *
         * @default true
         */
        showTrafficButton?: boolean;
        /**
         * The traffic source regex used to determine whether a layer displays traffic or not.
         *
         * @default /mapbox-traffic-v\d/
         */
        trafficSource?: RegExp;
    }
}

Additional Details

Credits

These definitions were written by Niek van Bennekom.

1.0.2

6 months ago

1.0.1

7 months ago

1.0.0

2 years ago