Last active
June 12, 2017 14:58
-
-
Save whitetigle/36d2df0a60e78e268882db246fc514e7 to your computer and use it in GitHub Desktop.
Fable MapBox integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Updated version thanks to excellent post from Zaid Ajaj | |
// https://medium.com/@zaid.naom/f-interop-with-javascript-in-fable-the-complete-guide-ccc5b896a59f | |
namespace Leaflet | |
module L = | |
open Fable.Core.JsInterop | |
open Fable.Core | |
type IMyOptions = | |
interface end | |
type MapOptions = | |
| ZoomControl of bool | |
| ScrollWheelZoom of bool | |
interface IMyOptions | |
type IMap = | |
abstract off : unit -> IMap | |
abstract remove : unit -> IMap | |
[<Emit("$0.setView($1,$2)")>] | |
abstract SetView : (float * float) * int -> IMap | |
type Mapbox = | |
[<Emit("L.mapbox.accessToken=$0")>] | |
static member AccessToken with set(token: string) : unit = jsNative | |
[<Emit("L.mapbox.map($0,$1,$2)")>] | |
static member Map(element: string, id: string, ?options: MapOptions): IMap = jsNative | |
type IMarker = | |
[<Emit("$0.addTo($1)")>] | |
abstract AddTo : IMap -> IMarker | |
[<Emit("$0.bindPopup($1)")>] | |
abstract BindPopup : string -> IMarker | |
[<Emit("L.marker([$0,$1])")>] | |
let Marker (lat:float) (long:float) : IMarker = jsNative |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment