Old map.locate option

I usually made this maps for the field

leaflet() %>% 
  addTiles() %>%
  setView(-71.0382679, 42.3489054, zoom = 18) %>% 
  addEasyButton(easyButton(
    icon="fa-crosshairs", title="Locate Me",
    onClick=JS("function(btn, map){ map.locate({setView: true, enableHighAccuracy: true }); }")))

New test for control.locate

with easybutton

I want a marker to follow me arround, so my first try was to just change .locate for .control.locate but no luck

leaflet() %>% 
  addTiles() %>%
  setView(-71.0382679, 42.3489054, zoom = 18) %>% 
  addEasyButton(easyButton(
    icon="fa-crosshairs", title="Follow Me",
    onClick=JS("function(btn, map){ map.control.locate()}")))

With htmlwidget

leaflet() %>% 
  addTiles() %>%
  setView(-71.0382679, 42.3489054, zoom = 18) %>%
  htmlwidgets::onRender("
    var lc = L.control.locate({
    position: 'topright'}
}).addTo(map);")