Looking at the code, I got it working (I used require.js
, but you can use whatever you want):
<!doctype html> <html> <head> <script data-main="main.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script> <script> requirejs.config({ paths: { "mapy-loader": "//api.mapy.cz/loader" }, shim: { 'mapy-loader': {exports: 'Loader'} } }); </script> </head> <body> <div id="mapa" style="width:600px; height:400px;"></div> </body> </html>
(Here it will not be displayed in this fragment, since JavaScript should be placed in a file named main.js
)
EDIT:
Adding a jspm / System.js snippet:
( main.js
does not change)
<!doctype html> <html> <head> <script src="jspm_packages/system.js"></script> <script> System.config({ baseURL: "/", defaultJSExtensions: true, transpiler: "babel", paths: { "mapy-loader": "//api.mapy.cz/loader" }, meta: { 'mapy-loader': { format: 'global', exports: 'Loader' } } }); </script> <script> System.import('main.js'); </script> Run </head> <body> <div id="mapa" style="width:600px; height:400px;"></div> </body> </html>
source share