Merge pull request #30688 from Fluccioni/missing-mapbox-classic-definition

feat(mapbox): add missing styleLayer definition
This commit is contained in:
Mine Starks
2018-11-28 19:32:10 -08:00
committed by GitHub
2 changed files with 17 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
// Type definitions for Mapbox 1.6
// Project: https://www.mapbox.com/mapbox.js/
// Definitions by: Maxime Fabre <https://github.com/anahkiasen>
// Florian Luccioni <https://github.com/Fluccioni>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -153,6 +154,20 @@ declare global {
getGeoJSON(): any;
}
// StyleLayer
//////////////////////////////////////////////////////////////////////
/**
* L.mapbox.styleLayer provides a way to integrate styles created with Mapbox Studio into your map.
*/
function styleLayer(url: string, options?: StyleLayerOptions): StyleLayer;
interface StyleLayerOptions extends Leaflet.TileLayerOptions {
sanitizer?(template: string): string;
}
type StyleLayer = Leaflet.TileLayer;
//////////////////////////////////////////////////////////////////////
////////////////////////////// GEOCODING /////////////////////////////
//////////////////////////////////////////////////////////////////////

View File

@@ -4,6 +4,8 @@ const mapboxTiles = L.tileLayer('https://{s}.tiles.mapbox.com/v3/examples.map-i8
const map = L.map('map').addLayer(mapboxTiles).setView(new L.LatLng([42.3610, -71.0587]), 15);
const lightTiles = L.mapbox.styleLayer('mapbox://styles/mapbox/light-v9').addTo(map);
const coordinates = document.getElementById('coordinates');
const marker = L.marker(new L.LatLng([0, 0]), {