I've some js files organized this way (see source):
gmaps4rails.base.js
: contains all the logicgmaps4rails.googlemaps.js
: contains functionsgmaps4rails.bing.js
: contains functions with the same name as the previous file
So basically, base
calls createMarkers()
which is in both googlemaps
and bing
.
From now, I load only one among gmaps4rails.googlemaps.js
and gmaps4rails.googlemaps.js
, depending on the map API I need, so it works fine.
Now I'd like to be able to have all files loaded (and keep them separate) BUT of course only include the code of the desired maps API.
Basically I think about something like:
if desiredApi == "googlemaps"
include GoogleMapsNameSpace content in BaseNameSpace
Thanks in advance.