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
- Last updated: Tue, 07 Nov 2023 09:09:39 GMT
- Dependencies: @types/mapbox-gl, @types/node
Credits
These definitions were written by Niek van Bennekom.