You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I create some applications with Electron. Now I have a problem with "Leaflet.contextmenu".
I'ts not working.
I began investigating and found a bug place:
(function(factory) { // Packaging/modules magic dance var L; if (typeof define === 'function' && define.amd) { // AMD define(['leaflet'], factory); } else if (typeof module === 'object' && typeof module.exports === 'object') { // Node/CommonJS L = require('leaflet'); module.exports = factory(L); } else { // Browser globals if (typeof window.L === 'undefined') { throw new Error('Leaflet must be loaded first'); } factory(window.L); } })
The fact is that Electron supports the require method on web pages(since it is based on Node.js). But this does not mean that it is necessary to load the leaflet module.
Here I see two nuances:
If I wanted to write an Electron application, I could probably use the leaflet module (I have never done that and I don’t know if it will work) instead of explicitly registering the link to leaflet.js on my html page. But I think it is necessary to give the user a choice of how to act.
A more interesting case is when Electron loads a web page from a site and the page uses leaflet and Leaflet.contextmenu. You cannot change the page content and should not force Electron to load the leaflet module. You must use a leaflet.js that is explicitly registered on the page.
I do not know the right decision.
It may be worth refusing to explicitly require ('leaflet').
Perhaps it is worth making a more intelligent determination of the presence of a loaded leaflet on the page.
Perhaps it is worth checking that the modules are supported and the type of browser - Electron (but I do not know how this will help).
The text was updated successfully, but these errors were encountered:
Hi.
I create some applications with Electron. Now I have a problem with "Leaflet.contextmenu".
I'ts not working.
I began investigating and found a bug place:
(function(factory) { // Packaging/modules magic dance var L; if (typeof define === 'function' && define.amd) { // AMD define(['leaflet'], factory); } else if (typeof module === 'object' && typeof module.exports === 'object') { // Node/CommonJS L = require('leaflet'); module.exports = factory(L); } else { // Browser globals if (typeof window.L === 'undefined') { throw new Error('Leaflet must be loaded first'); } factory(window.L); } })
The fact is that Electron supports the require method on web pages(since it is based on Node.js). But this does not mean that it is necessary to load the leaflet module.
Here I see two nuances:
I do not know the right decision.
The text was updated successfully, but these errors were encountered: