RequireJS is a modular JavaScript file loader that some sites use to organize and optimize their JavaScript files. If your website (or platform) is using it, rest assured that SimpleMaps will still work. Although SimpleMaps is not AMD aware, you can easily install SimpleMaps as a legacy third-party library.
Here's what you need to do (example):
Choose the map you want to install:
mapdata.js
and usmap.js
to the RequireJS library folder as defined by baseUrl
in the configuration file. In this example, this is the lib
directory. Also, add the require.js
to this directory.app.js
file, use shim
within the config
method to include the mapdata.js
and usmap.js
files. Here is what our example configuration looks like:requirejs.config({
baseUrl: 'lib',
paths: {
app: '../app'
},
shim: {
'mapdata': {
exports: 'simplemaps_usmap_mapdata'
},
'usmap': {
exports: 'simplemaps_usmap'
}
}
});
app/main.js
, which will contain the application logic.requirejs(['app/main']);
In the main.js file, require both mapdata
and usmap
:
define(function (require) {
require('mapdata');
require('usmap');
});
<head>
: <script data-main="app" src="lib/require.js"></script>
<div id="map"></div>
Home | License | Privacy | Releases | Testimonials | Resources | Documentation | Order Lookup | All Maps | FAQs
Formerly FlashUSAmap.com and FlashWorldMap.com
SimpleMaps.com is a product of Pareto Software, LLC. © 2010-2024.