mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
Added type definitions for leaflet-responsive-popup (#37814)
* Added type definitions for leaflet-responsive-popup * Added function responsivePopup and capitalized class name to ResponsivePopup. Extended tests to initialize a class and to invoke a function. Strictness turned on (tsconfig).
This commit is contained in:
committed by
Sheetal Nandi
parent
a05485d556
commit
cfca13ec2d
19
types/leaflet-responsive-popup/index.d.ts
vendored
Normal file
19
types/leaflet-responsive-popup/index.d.ts
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
// Type definitions for leaflet-responsive-popup 0.6
|
||||
// Project: https://github.com/yafred/leaflet-responsive-popup
|
||||
// Definitions by: Stan Kurek <https://github.com/stankurek>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as L from 'leaflet';
|
||||
|
||||
declare module 'leaflet' {
|
||||
interface ResponsivePopupOptions extends PopupOptions {
|
||||
hasTip?: boolean;
|
||||
}
|
||||
|
||||
class ResponsivePopup extends Popup {
|
||||
constructor(options?: ResponsivePopupOptions, source?: Layer);
|
||||
}
|
||||
|
||||
function responsivePopup(options?: ResponsivePopupOptions, source?: Layer): ResponsivePopup;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import * as L from 'leaflet';
|
||||
import 'leaflet-responsive-popup';
|
||||
|
||||
const osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
||||
const osmAttrib = '© <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors';
|
||||
const osmTile = L.tileLayer(osmUrl, { maxZoom: 18, attribution: osmAttrib });
|
||||
const map = new L.Map('map', {
|
||||
layers: [osmTile],
|
||||
center: new L.LatLng(50.054, 19.933),
|
||||
zoom: 13,
|
||||
});
|
||||
|
||||
const circle1 = L.circle([50.054, 19.933], {
|
||||
color: 'red',
|
||||
fillColor: '#f03',
|
||||
fillOpacity: 0.5,
|
||||
radius: 120,
|
||||
}).addTo(map);
|
||||
|
||||
const popup1 = L.responsivePopup({ hasTip: false, autoPan: false }, circle1)
|
||||
.setLatLng([50.054, 19.933])
|
||||
.setContent('Test popup 1');
|
||||
|
||||
circle1.bindPopup(popup1);
|
||||
|
||||
const circle2 = L.circle([50.154, 20.033], {
|
||||
color: 'red',
|
||||
fillColor: '#f03',
|
||||
fillOpacity: 0.5,
|
||||
radius: 120,
|
||||
}).addTo(map);
|
||||
|
||||
const popup2 = new L.ResponsivePopup({ hasTip: false, autoPan: false }, circle2)
|
||||
.setLatLng([50.154, 20.033])
|
||||
.setContent('Test popup 2');
|
||||
|
||||
circle2.bindPopup(popup2);
|
||||
24
types/leaflet-responsive-popup/tsconfig.json
Normal file
24
types/leaflet-responsive-popup/tsconfig.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"leaflet-responsive-popup-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/leaflet-responsive-popup/tslint.json
Normal file
1
types/leaflet-responsive-popup/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user