@uiw/react-amap-require-script
Advanced tools
Comparing version 2.2.1 to 2.2.2
"use strict"; | ||
exports.__esModule = true; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.requireCss = requireCss; | ||
@@ -26,3 +28,3 @@ exports.requireScript = requireScript; | ||
headElement.removeChild(script); | ||
reject(new URIError("The css " + src + " is no accessible.")); | ||
reject(new URIError("The css ".concat(src, " is no accessible."))); | ||
}; | ||
@@ -43,7 +45,4 @@ | ||
function requireScript(src, id) { | ||
if (id === void 0) { | ||
id = '_react_amap'; | ||
} | ||
function requireScript(src) { | ||
var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '_react_amap'; | ||
var headElement = document && (document.head || document.getElementsByTagName('head')[0]); | ||
@@ -65,3 +64,3 @@ return new Promise(function (resolve, reject) { | ||
headElement.removeChild(script); | ||
reject(new URIError("The Script " + src + " is no accessible.")); | ||
reject(new URIError("The Script ".concat(src, " is no accessible."))); | ||
}; | ||
@@ -68,0 +67,0 @@ |
@@ -0,1 +1,8 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.requireCss = requireCss; | ||
exports.requireScript = requireScript; | ||
var _importedScript = {}; | ||
@@ -6,5 +13,5 @@ /** | ||
export function requireCss(src) { | ||
function requireCss(src) { | ||
var headElement = document && (document.head || document.getElementsByTagName('head')[0]); | ||
return new Promise(function (resolve, reject) { | ||
return new Promise((resolve, reject) => { | ||
if (!document || src in _importedScript) { | ||
@@ -20,3 +27,3 @@ resolve(); | ||
script.onerror = function (err) { | ||
script.onerror = err => { | ||
headElement.removeChild(script); | ||
@@ -26,3 +33,3 @@ reject(new URIError("The css " + src + " is no accessible.")); | ||
script.onload = function () { | ||
script.onload = () => { | ||
_importedScript[src] = true; | ||
@@ -39,3 +46,4 @@ resolve(); | ||
export function requireScript(src, id) { | ||
function requireScript(src, id) { | ||
if (id === void 0) { | ||
@@ -46,3 +54,3 @@ id = '_react_amap'; | ||
var headElement = document && (document.head || document.getElementsByTagName('head')[0]); | ||
return new Promise(function (resolve, reject) { | ||
return new Promise((resolve, reject) => { | ||
if (!document || src in _importedScript) { | ||
@@ -60,3 +68,3 @@ resolve(); | ||
script.onerror = function (err) { | ||
script.onerror = err => { | ||
headElement.removeChild(script); | ||
@@ -66,3 +74,3 @@ reject(new URIError("The Script " + src + " is no accessible.")); | ||
script.onload = function () { | ||
script.onload = () => { | ||
_importedScript[src] = true; | ||
@@ -69,0 +77,0 @@ resolve(); |
{ | ||
"name": "@uiw/react-amap-require-script", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "基于 React 封装的高德地图组件。AMap Component Based On React.", | ||
@@ -36,8 +36,8 @@ "homepage": "https://uiwjs.github.io/react-amap/#/api-loader", | ||
"dependencies": { | ||
"@uiw/react-amap-types": "^2.2.1" | ||
"@uiw/react-amap-types": "^2.2.2" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "17.0.19", | ||
"@types/react": "17.0.20", | ||
"@types/react-dom": "17.0.9" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16225
191
Updated@uiw/react-amap-types@^2.2.2