@uiw/react-amap-require-script
Advanced tools
Comparing version
@@ -9,6 +9,6 @@ "use strict"; | ||
var _importedScript = {}; | ||
/** | ||
* load dependency by css tag | ||
*/ | ||
function requireCss(src) { | ||
@@ -23,3 +23,2 @@ var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '_react_amap_css'; | ||
} | ||
var script = document.createElement('link'); | ||
@@ -30,3 +29,2 @@ script.type = 'text/css'; | ||
script.href = src; | ||
script.onerror = function (err) { | ||
@@ -36,3 +34,2 @@ headElement.removeChild(script); | ||
}; | ||
script.onload = function () { | ||
@@ -42,11 +39,9 @@ _importedScript[src] = true; | ||
}; | ||
headElement.appendChild(script); | ||
}); | ||
} | ||
/** | ||
* load dependency by script tag | ||
*/ | ||
function requireScript(src) { | ||
@@ -61,3 +56,2 @@ var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '_react_amap_plugin'; | ||
} | ||
var script = document.createElement('script'); | ||
@@ -69,3 +63,2 @@ script.type = 'text/javascript'; | ||
script.src = src; | ||
script.onerror = function (err) { | ||
@@ -75,3 +68,2 @@ headElement.removeChild(script); | ||
}; | ||
script.onload = function () { | ||
@@ -81,3 +73,2 @@ _importedScript[src] = true; | ||
}; | ||
headElement.appendChild(script); | ||
@@ -84,0 +75,0 @@ }); |
var _importedScript = {}; | ||
/** | ||
* load dependency by css tag | ||
*/ | ||
export function requireCss(src, id) { | ||
@@ -10,3 +10,2 @@ if (id === void 0) { | ||
} | ||
var headElement = document && (document.head || document.getElementsByTagName('head')[0]); | ||
@@ -19,3 +18,2 @@ var dom = document.getElementById(id); | ||
} | ||
var script = document.createElement('link'); | ||
@@ -26,3 +24,2 @@ script.type = 'text/css'; | ||
script.href = src; | ||
script.onerror = err => { | ||
@@ -32,3 +29,2 @@ headElement.removeChild(script); | ||
}; | ||
script.onload = () => { | ||
@@ -38,10 +34,9 @@ _importedScript[src] = true; | ||
}; | ||
headElement.appendChild(script); | ||
}); | ||
} | ||
/** | ||
* load dependency by script tag | ||
*/ | ||
export function requireScript(src, id) { | ||
@@ -51,3 +46,2 @@ if (id === void 0) { | ||
} | ||
var headElement = document && (document.head || document.getElementsByTagName('head')[0]); | ||
@@ -60,3 +54,2 @@ var dom = document.getElementById(id); | ||
} | ||
var script = document.createElement('script'); | ||
@@ -68,3 +61,2 @@ script.type = 'text/javascript'; | ||
script.src = src; | ||
script.onerror = err => { | ||
@@ -74,3 +66,2 @@ headElement.removeChild(script); | ||
}; | ||
script.onload = () => { | ||
@@ -80,3 +71,2 @@ _importedScript[src] = true; | ||
}; | ||
headElement.appendChild(script); | ||
@@ -83,0 +73,0 @@ }); |
{ | ||
"name": "@uiw/react-amap-require-script", | ||
"version": "4.0.2", | ||
"version": "4.0.3", | ||
"description": "基于 React 封装的高德地图组件。AMap Component Based On React.", | ||
@@ -36,3 +36,3 @@ "homepage": "https://uiwjs.github.io/react-amap/#/api-loader", | ||
"dependencies": { | ||
"@uiw/react-amap-types": "4.0.2" | ||
"@uiw/react-amap-types": "4.0.3" | ||
}, | ||
@@ -39,0 +39,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
17361
-0.07%+ Added
- Removed
Updated