@uiw/react-amap-api-loader
Advanced tools
Comparing version 2.6.2 to 2.7.0
@@ -61,2 +61,3 @@ import React, { Component } from 'react'; | ||
}; | ||
private isMountedOk; | ||
/** | ||
@@ -69,2 +70,3 @@ * 全局可能存在多个 Loader 同时渲染, 但是只能由一个负责加载 | ||
componentDidMount(): void; | ||
componentWillUnmount(): void; | ||
render(): React.ReactNode; | ||
@@ -71,0 +73,0 @@ private getScriptSrc; |
@@ -62,2 +62,3 @@ "use strict"; | ||
_this = _super.call(this, props); | ||
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "isMountedOk", false); | ||
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", { | ||
@@ -67,10 +68,14 @@ loaded: !!window.AMap | ||
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleError", function (error) { | ||
_this.setState({ | ||
error: error | ||
}); | ||
if (_this.isMountedOk) { | ||
_this.setState({ | ||
error: error | ||
}); | ||
} | ||
}); | ||
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "finish", function () { | ||
_this.setState({ | ||
loaded: true | ||
}); | ||
if (_this.isMountedOk) { | ||
_this.setState({ | ||
loaded: true | ||
}); | ||
} | ||
}); | ||
@@ -88,2 +93,3 @@ | ||
value: function componentDidMount() { | ||
this.isMountedOk = true; | ||
var callbackName = this.props.callbackName; | ||
@@ -101,2 +107,7 @@ | ||
}, { | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
this.isMountedOk = false; | ||
} | ||
}, { | ||
key: "render", | ||
@@ -103,0 +114,0 @@ value: function render() { |
@@ -61,2 +61,3 @@ import React, { Component } from 'react'; | ||
}; | ||
private isMountedOk; | ||
/** | ||
@@ -69,2 +70,3 @@ * 全局可能存在多个 Loader 同时渲染, 但是只能由一个负责加载 | ||
componentDidMount(): void; | ||
componentWillUnmount(): void; | ||
render(): React.ReactNode; | ||
@@ -71,0 +73,0 @@ private getScriptSrc; |
@@ -22,2 +22,3 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator"; | ||
super(props); | ||
this.isMountedOk = false; | ||
this.state = { | ||
@@ -28,11 +29,15 @@ loaded: !!window.AMap | ||
this.handleError = error => { | ||
this.setState({ | ||
error | ||
}); | ||
if (this.isMountedOk) { | ||
this.setState({ | ||
error | ||
}); | ||
} | ||
}; | ||
this.finish = () => { | ||
this.setState({ | ||
loaded: true | ||
}); | ||
if (this.isMountedOk) { | ||
this.setState({ | ||
loaded: true | ||
}); | ||
} | ||
}; | ||
@@ -46,2 +51,3 @@ | ||
componentDidMount() { | ||
this.isMountedOk = true; | ||
var { | ||
@@ -61,2 +67,6 @@ callbackName | ||
componentWillUnmount() { | ||
this.isMountedOk = false; | ||
} | ||
render() { | ||
@@ -63,0 +73,0 @@ if (this.state.loaded) { |
{ | ||
"name": "@uiw/react-amap-api-loader", | ||
"version": "2.6.2", | ||
"version": "2.7.0", | ||
"description": "用于加载高德地图 SDK 依赖,加载完成,全局将会有 **`window.AMap`** 对象。", | ||
@@ -36,4 +36,4 @@ "homepage": "https://uiwjs.github.io/react-amap/#/api-loader", | ||
"dependencies": { | ||
"@uiw/react-amap-require-script": "2.6.2", | ||
"@uiw/react-amap-types": "2.6.2" | ||
"@uiw/react-amap-require-script": "2.7.0", | ||
"@uiw/react-amap-types": "2.7.0" | ||
}, | ||
@@ -40,0 +40,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
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
41376
663
+ Added@uiw/react-amap-require-script@2.7.0(transitive)
+ Added@uiw/react-amap-types@2.7.0(transitive)
- Removed@uiw/react-amap-require-script@2.6.2(transitive)
- Removed@uiw/react-amap-types@2.6.2(transitive)
Updated@uiw/react-amap-types@2.7.0