Skip to content

Instantly share code, notes, and snippets.

@LosantGists
Created July 26, 2023 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LosantGists/8324e7031ba692daf0e32d46aec55b9f to your computer and use it in GitHub Desktop.
Save LosantGists/8324e7031ba692daf0e32d46aec55b9f to your computer and use it in GitHub Desktop.
Sets up variables 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