Skip to content

Instantly share code, notes, and snippets.

@tmdesigned
Created July 3, 2023 13:52
Show Gist options
  • Select an option

  • Save tmdesigned/514cc4c9e7f836a57ffffbf0c8c4a4ef to your computer and use it in GitHub Desktop.

Select an option

Save tmdesigned/514cc4c9e7f836a57ffffbf0c8c4a4ef to your computer and use it in GitHub Desktop.
Set up globals and listeners
// Excerpt from https://github.com/Losant/google-map-advanced-markers/blob/main/custom-head-content.html
// Initialize globals
const markers = {};
let devices = [];
let map;
let numSelected = 0;
let AdvancedMarkerElement;
let bounds;
let selectedAttribute = $('#attribute-selector').val() || 'battery';
// Rebuild markers when changing attribute
$(document).on('change','#attribute-selector',() => {
selectedAttribute = $('#attribute-selector').val();
resetMarkers();
setAllMarkers();
});
// ...other functions...
initMap();
DashboardBlock.on('change', updateMap);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment