@types/mapbox__mapbox-gl-traffic
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

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

/// <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.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/mapbox__mapbox-gl-traffic

Weekly Downloads

62

Version

1.0.2

License

MIT

Unpacked Size

5.59 kB

Total Files

5

Last publish

Collaborators

  • types