Skip to content

Commit

Permalink
chore(lib): compile from src using babel
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchentw committed Oct 4, 2016
1 parent 999fd89 commit ea0a84b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
17 changes: 17 additions & 0 deletions lib/OverlayView.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,23 @@ var OverlayView = function (_Component) {

this.setState({ overlayView: overlayView });
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
if (!_canUseDom2.default) {
return;
}

var anchorHolderRef = this.props.anchorHolderRef;
var overlayView = this.state.overlayView;


if (anchorHolderRef) {
if ("MarkerClusterer" === anchorHolderRef.getAnchorType()) {
anchorHolderRef.getAnchor().removeMarker(overlayView);
}
}
}
}, {
key: "render",
value: function render() {
Expand Down
14 changes: 13 additions & 1 deletion lib/async/ScriptjsLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ var ScriptjsLoader = function (_Component) {
}

(0, _createClass3.default)(ScriptjsLoader, [{
key: "setLoaded",
value: function setLoaded() {
this.setState({ isLoaded: true });
}
}, {
key: "shouldUseNewBehavior",
value: function shouldUseNewBehavior() {
var _props$googleMapEleme = this.props.googleMapElement.props;
Expand Down Expand Up @@ -112,7 +117,7 @@ var ScriptjsLoader = function (_Component) {
var urlObj = { protocol: protocol, hostname: hostname, port: port, pathname: pathname, query: query };
var url = (0, _makeUrl2.default)(urlObj);
scriptjs(url, function () {
return _this2.setState({ isLoaded: true });
return _this2.setLoaded();
});
}
}, {
Expand All @@ -124,6 +129,13 @@ var ScriptjsLoader = function (_Component) {
(0, _warning2.default)(changedKeys.length === 0, "ScriptjsLoader doesn't support mutating url related props after initial render.\nChanged props: %s", "[" + changedKeys.join(", ") + "]");
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
// Set this to a no-op so we avoid using setState when the
// component is unmounted;
this.setLoaded = function () {};
}
}, {
key: "render",
value: function render() {
Expand Down

0 comments on commit ea0a84b

Please sign in to comment.