Я написал следующий код. Как я могу добавить карту Google и некоторые координаты в электронике. Сгенерированная ошибка упоминается ниже,
const {app, BrowserWindow} = require('electron')
const url = require('url')
const path = require('path')
const {Menu} = require('electron')
const loadGoogleMapsApi = require('load-google-maps-api')
let win
app.on('ready',function() {
win = new BrowserWindow({})
win.loadURL(url.format ({
pathname: path.join(__dirname, 'home.html'),
protocol: 'file:',
slashes: true
}));
});
loadGoogleMapsApi().then(function (googleMaps) {
new googleMaps.Map(document.querySelector('.map'), {
center: {
lat: 40.7484405,
lng: -73.9944191
},
zoom: 12
})
}).catch(function (error) {
console.error(error)
})
Я не знаю, как решить эту проблему ...
Генерирует ошибку, которая указана ниже,
Ссылочная ошибка:
window is not defined
at /home/ebuilders/Desktop/ElectronApplication/node_modules/load-google-maps-api/index.js:19:7
at new Promise (<anonymous>)
at module.exports (/home/ebuilders/Desktop/ElectronApplication/node_modules/load-google-maps-api/index.js:11:15)
at Object.<anonymous> (/home/ebuilders/Desktop/ElectronApplication/process.js:19:1)
at Object.<anonymous> (/home/ebuilders/Desktop/ElectronApplication/process.js:31:3)
at Module._compile (module.js:642:30)
at Object.Module._extensions..js (module.js:653:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
Любая помощь будет оценена.