diff --git a/leaflet.awesome-markers/leaflet.awesome-markers-tests.ts b/leaflet.awesome-markers/leaflet.awesome-markers-tests.ts new file mode 100644 index 000000000..2ac33184b --- /dev/null +++ b/leaflet.awesome-markers/leaflet.awesome-markers-tests.ts @@ -0,0 +1,18 @@ +/// + +var map: L.Map; + +var redMarker = L.AwesomeMarkers.icon({ + icon: 'coffee', + markerColor: 'red' +}); + +var blueMarker = new L.AwesomeMarkers.Icon({ + icon: 'star', + markerColor: 'blue' +}); + +L.marker([51.941196, 4.512291], { icon: redMarker }).addTo(map); +L.marker([51.941196, 4.512291], { icon: blueMarker }).addTo(map); + +L.AwesomeMarkers.Icon.prototype.options.prefix = 'ion'; \ No newline at end of file diff --git a/leaflet.awesome-markers/leaflet.awesome-markers.d.ts b/leaflet.awesome-markers/leaflet.awesome-markers.d.ts new file mode 100644 index 000000000..6fa754ad8 --- /dev/null +++ b/leaflet.awesome-markers/leaflet.awesome-markers.d.ts @@ -0,0 +1,68 @@ +// Type definitions for Leaflet.awesome-markers plugin v2.0 +// Project: https://github.com/lvoogdt/Leaflet.awesome-markers +// Definitions by: Egor Komarov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module L { + module AwesomeMarkers { + var version: string; + + function icon(options: AwesomeMarkers.IconOptions): AwesomeMarkers.Icon; + + interface IconStatic extends L.IconStatic { + /** + * Creates an icon instance with the given options. + */ + new (options: IconOptions): Icon; + + Default: { + /** + * Creates a default icon instance with the given options. + */ + new (options?: IconOptions): Icon.Default; + + imagePath: string; + }; + } + + interface Icon extends L.Icon { + options: AwesomeMarkers.IconOptions; + } + + interface IconOptions extends L.IconOptions { + /** + * Name of the icon. See glyphicons or font-awesome. + */ + icon?: string; + + /** + * Select de icon library. 'fa' for font-awesome or 'glyphicon' for bootstrap 3. + */ + prefix?: 'fa' | 'glyphicon'; + + /** + * Color of the marker + */ + markerColor?: 'red' | 'darkred' | 'orange' | 'green' | 'darkgreen' | 'blue' | 'purple' | 'darkpuple' | 'cadetblue'; + + /** + * Color of the icon. 'white', 'black' or css code (hex, rgba etc). + */ + iconColor?: 'white' | 'black' | string; + + /** + * Make the icon spin. true or false. Font-awesome required + */ + spin?: boolean; + + /** + * Additional classes in the created tag + */ + extraClasses?: string; + } + + var Icon: AwesomeMarkers.IconStatic; + } +}