Skip to content

copying and pasting code from wiki results in two onloads #5

@rmglennon

Description

@rmglennon

https://github.com/mapzen/electron-quick-start/wiki/How-to-Electron-Workshop#lets-add-a-map

The template and this step results in there being town onloads, so the map does not display. Just needs a few text tweaks to give the context of where to paste the code without ending up with duplication.

https://github.com/mapzen/electron-quick-start/blob/master/index_renderer.js#L4

  1. Add a global map variable just above the page loading handler function and a call to initMap() inside the loading handler.
const api_key = 'mapzen-xxxxxxx';
let map; // <--- global map variable

// handle window loading event
document.getElementById('body').onload = function () {
  console.log('good news: index window is loading!');  

  initMap(); // <--- initialize your map
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions