How about making the asynchronous call when building the map? Such as:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
...
module GoogleMaps =
    open IntelliFactory.WebSharper.EcmaScript
 
    [<JavaScript>]
    let Sample buildMap =
        Div [Attr.Style "padding-bottom:20px; width:500px; height:300px;"]
        |>! OnAfterRender (fun mapElement ->
            async {
                   let! position = Geolocation.GetPosition()
                   let coords = position.Coords
                   let center = new LatLng(coords.Latitude, coords.Longitude)
                   let options = new MapOptions(15, center, MapTypeId.ROADMAP)
                   let map = new Google.Maps.Map(mapElement.Body, options)
                   buildMap map
            }
            |> Async.Start |> ignore
)
By on 4/13/2013 5:05 AM ()

Thank you. :)

By on 4/13/2013 7:40 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper