title: How to run multiple `mapdeck_view` calls sequentially?
body: <p>I'm making a <code>mapdeck</code> map in an R <code>shiny</code> app that features a button that takes the user to  a list of locations. The user clicks on the <code>actionButton</code> (Demo) and the <code>observeEvent</code> function iterates over the list of locations, camera settings, etc and zooms to the locations using the <code>movecam</code> function.</p>
  
  <p>The problem I'm having is that the app doesn't wait for one zoom task to finish and immediately executes the next one. This results in only the last location being zoomed to. I tried making the app wait for the zoom tasks to finish using <code>shinyjs::delay</code> and <code>Sys.delay</code> in various places, but these functions don't seem to help in the way I need them. Any ideas?</p>
  
  <p>I included a reproducible example that should zoom to three locations sequentially. You need to replace the dummy mapbox token for it to display a map, though.</p>
  
  <pre><code>library (mapdeck)
  library (shiny)
  library (shinyjs)
  library (shinyWidgets)
  
  ui &lt;- shinyUI (pageWithSidebar (
    headerPanel(title = "Demo"),
    sidebarPanel = sidebarPanel (
      actionButton ("demo", "Demo")
    ),
    mainPanel = mainPanel (
      useShinyjs (),
      mapdeckOutput (outputId = "map", height = "900px", width = "100%")
    )
  ))
  
  movecam &lt;- function (location, zoom, duration, transition = "fly", pitch,
                       bearing, delay)
  {
    print ("moving camera")
    mapdeck_update (map_id = "map") %&gt;%
      mapdeck_view (location = location, zoom = zoom,
                    duration = duration, transition = transition,
                    pitch = pitch, bearing = bearing)
  }
  
  server &lt;- function(input, output, session) {
  
    observeEvent(input$demo, {
      locations &lt;- list (c (100, 30), # China
                         c (-75, -8), # Peru
                         c (23, -21)) # Botswana
      zooms &lt;- c (11, 12, 13)
      durations &lt;- c (3500, 2000, 5000)
      pitches &lt;- c (40, 50, 300)
      bearings &lt;- c (100, 400, 200)
  
      for (i in seq_len (length (locations)))
      {
        delay &lt;- durations [i]
        if (i == 1)
          delay &lt;- 0
  
        delay (delay,
        movecam (location = locations [[i]], zoom = zooms [i],
                 duration = durations [i], transition = "fly", pitch = pitches [i],
                 bearing = bearings [i], delay = delay)
        )
        #Sys.sleep(delay / 1000)
      }
    })
  
    output$map &lt;- renderMapdeck({
      mapdeck (token = "abcdef")
    })
  }
  
  shinyApp (ui, server)
  </code></pre>