Improves argument handling and script loading
This commit is contained in:
1 parent
177b70631b
commit
46add3f003
4 files changed
+181
-53
No files matched your search
@@ -0,0 +1,18 @@
|
||||
var openfreemapModuleUrl;
|
||||
var openfreemapStyleUrl;
|
||||
|
||||
if (document.querySelector('.openfreemap') && typeof openfreemapModuleUrl === 'string') {
|
||||
if (typeof openfreemapStyleUrl === 'string') {
|
||||
var link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.href = openfreemapStyleUrl;
|
||||
link.onerror = function () {
|
||||
console.error('[OpenFreeMap] Failed to load the map stylesheet.');
|
||||
};
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
|
||||
import(openfreemapModuleUrl).catch(function (error) {
|
||||
console.error('[OpenFreeMap] Failed to load the map library.', error);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user