mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #18104 from BendingBender/leaflet-providers
[leaflet-providers] introduce typings
This commit is contained in:
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
// Type definitions for leaflet-providers 1.1
|
||||
// Project: https://github.com/leaflet-extras/leaflet-providers#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="leaflet" />
|
||||
|
||||
declare namespace L {
|
||||
namespace TileLayer {
|
||||
class Provider extends TileLayer {
|
||||
constructor(provider: string, options?: TileLayerOptions)
|
||||
}
|
||||
|
||||
namespace Provider {
|
||||
const providers: ProvidersMap;
|
||||
|
||||
interface ProvidersMap {
|
||||
[providerName: string]: ProviderConfig;
|
||||
}
|
||||
|
||||
interface ProviderConfig {
|
||||
url: string;
|
||||
options?: TileLayerOptions;
|
||||
variants?: { [variantName: string]: string | ProviderConfig };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace tileLayer {
|
||||
function provider(provider: string, options?: TileLayerOptions): TileLayer.Provider;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
const map = L.map('map');
|
||||
L.tileLayer.provider('Stamen.Watercolor').addTo(map);
|
||||
|
||||
L.tileLayer.provider('HERE.terrainDay', {
|
||||
app_id: '<insert ID here>',
|
||||
app_code: '<insert ID here>'
|
||||
}).addTo(map);
|
||||
|
||||
new L.TileLayer.Provider('MapBox').addTo(map);
|
||||
new L.TileLayer.Provider('MapBox', {id: 'ID', accessToken: 'ACCESS_TOKEN'}).addTo(map);
|
||||
|
||||
L.TileLayer.Provider.providers['nlmaps'] = {
|
||||
url: 'https://geodata.nationaalgeoregister.nl/tiles/service/wmts/{variant}/EPSG:3857/{z}/{x}/{y}.png',
|
||||
options: {
|
||||
minZoom: 6,
|
||||
maxZoom: 19,
|
||||
bounds: [[50.5, 3.25], [54, 7.6]],
|
||||
attribution: 'Kaartgegevens © <a href="kadaster.nl">Kadaster</a>'
|
||||
},
|
||||
variants: {
|
||||
standaard: 'brtachtergrondkaart',
|
||||
pastel: 'brtachtergrondkaartpastel',
|
||||
grijs: 'brtachtergrondkaartgrijs',
|
||||
luchtfoto: {
|
||||
url: 'https://geodata.nationaalgeoregister.nl/luchtfoto/rgb/wmts/1.0.0/2016_ortho25/EPSG:3857/{z}/{x}/{y}.png',
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"leaflet-providers-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user