@react-google-maps/api
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -38,2 +38,4 @@ "use strict"; | ||
var _isbrowser = require("./utils/isbrowser"); | ||
var cleaningUp = false; | ||
@@ -64,8 +66,10 @@ | ||
} else { | ||
var timer = setInterval(function () { | ||
if (!cleaningUp) { | ||
clearInterval(timer); | ||
resolve(); | ||
} | ||
}, 1); | ||
if (_isbrowser.isBrowser) { | ||
var timer = window.setInterval(function () { | ||
if (!cleaningUp) { | ||
window.clearInterval(timer); | ||
resolve(); | ||
} | ||
}, 1); | ||
} | ||
} | ||
@@ -142,8 +146,10 @@ })); | ||
value: function componentDidMount() { | ||
if (window.google && !cleaningUp) { | ||
console.error('google api is already presented'); | ||
return; | ||
if (_isbrowser.isBrowser) { | ||
if (window.google && !cleaningUp) { | ||
console.error('google api is already presented'); | ||
return; | ||
} | ||
this.isCleaningUp().then(this.injectScript); | ||
} | ||
this.isCleaningUp().then(this.injectScript); | ||
} | ||
@@ -155,3 +161,3 @@ }, { | ||
if (prevProps.language !== this.props.language) { | ||
if (_isbrowser.isBrowser && prevProps.language !== this.props.language) { | ||
this.cleanup(); // TODO: There should be better way to do it, but I don't have time now :) | ||
@@ -176,10 +182,12 @@ // eslint-disable-next-line react/no-did-update-set-state | ||
this.cleanup(); | ||
setTimeout(function () { | ||
if (!_this3.check.current) { | ||
delete window.google; | ||
cleaningUp = false; | ||
} | ||
}, 1); | ||
this.props.onUnmount(); | ||
if (_isbrowser.isBrowser) { | ||
this.cleanup(); | ||
setTimeout(function () { | ||
if (!_this3.check.current) { | ||
delete window.google; | ||
cleaningUp = false; | ||
} | ||
}, 1); | ||
this.props.onUnmount(); | ||
} | ||
} | ||
@@ -186,0 +194,0 @@ }, { |
{ | ||
"name": "@react-google-maps/api", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "React.js Google Maps API integration", | ||
@@ -26,3 +26,2 @@ "license": "MIT", | ||
"dist/", | ||
"examples/", | ||
"lib/", | ||
@@ -128,13 +127,13 @@ "src/", | ||
"@types/markerclustererplus": "2.1.33", | ||
"@types/react": "16.8.0", | ||
"@types/react": "16.8.1", | ||
"@types/react-dom": "16.0.11", | ||
"@types/webpack-bundle-analyzer": "2.13.0", | ||
"acorn": "6.0.6", | ||
"acorn": "6.0.7", | ||
"babel-eslint": "10.0.1", | ||
"babel-loader": "8.0.5", | ||
"babel-plugin-macros": "2.4.5", | ||
"babel-plugin-transform-react-remove-prop-types": "0.4.23", | ||
"babel-plugin-transform-react-remove-prop-types": "0.4.24", | ||
"concurrently": "4.1.0", | ||
"cross-env": "5.2.0", | ||
"eslint": "5.12.1", | ||
"eslint": "5.13.0", | ||
"eslint-config-standard": "12.0.0", | ||
@@ -148,6 +147,6 @@ "eslint-config-standard-react": "7.0.2", | ||
"eslint-plugin-filenames": "1.3.2", | ||
"eslint-plugin-html": "5.0.0", | ||
"eslint-plugin-html": "5.0.3", | ||
"eslint-plugin-import": "2.16.0", | ||
"eslint-plugin-json": "1.3.2", | ||
"eslint-plugin-jsx-a11y": "6.2.0", | ||
"eslint-plugin-jsx-a11y": "6.2.1", | ||
"eslint-plugin-no-inferred-method-name": "1.0.2", | ||
@@ -164,3 +163,3 @@ "eslint-plugin-node": "8.0.1", | ||
"husky": "1.3.1", | ||
"lint-staged": "8.1.1", | ||
"lint-staged": "8.1.3", | ||
"npm-watch": "0.6.0", | ||
@@ -172,9 +171,9 @@ "prop-types": "15.6.2", | ||
"standard-version": "4.4.0", | ||
"terser-webpack-plugin": "1.2.1", | ||
"terser-webpack-plugin": "1.2.2", | ||
"typescript": "3.3.1", | ||
"webpack": "4.29.0", | ||
"webpack": "4.29.1", | ||
"webpack-bundle-analyzer": "3.0.3", | ||
"webpack-cli": "3.2.1" | ||
}, | ||
"gitHead": "28ccd5da0d0d5b2055ef48c957004b18b82ad8fd" | ||
"gitHead": "3d83e3e5fcea1675794b68fff588d39b85c90451" | ||
} |
@@ -6,2 +6,4 @@ import React, { Component } from 'react' | ||
import { isBrowser } from './utils/isbrowser' | ||
let cleaningUp = false | ||
@@ -29,13 +31,18 @@ | ||
componentDidMount () { | ||
if (window.google && !cleaningUp) { | ||
console.error('google api is already presented') | ||
return | ||
if (isBrowser) { | ||
if (window.google && !cleaningUp) { | ||
console.error('google api is already presented') | ||
return | ||
} | ||
this.isCleaningUp() | ||
.then(this.injectScript) | ||
} | ||
this.isCleaningUp() | ||
.then(this.injectScript) | ||
} | ||
componentDidUpdate (prevProps) { | ||
if (prevProps.language !== this.props.language) { | ||
if ( | ||
isBrowser && | ||
prevProps.language !== this.props.language | ||
) { | ||
this.cleanup() | ||
@@ -51,2 +58,3 @@ | ||
delete window.google | ||
this.injectScript() | ||
@@ -59,13 +67,18 @@ } | ||
componentWillUnmount () { | ||
this.cleanup() | ||
if (isBrowser) { | ||
this.cleanup() | ||
setTimeout(() => { | ||
if (!this.check.current) { | ||
delete window.google | ||
cleaningUp = false | ||
} | ||
}, 1) | ||
setTimeout( | ||
() => { | ||
if (!this.check.current) { | ||
delete window.google | ||
cleaningUp = false | ||
} | ||
}, | ||
1 | ||
) | ||
this.props | ||
.onUnmount() | ||
this.props | ||
.onUnmount() | ||
} | ||
} | ||
@@ -77,11 +90,16 @@ | ||
resolve() | ||
} else { | ||
if (isBrowser) { | ||
const timer = window.setInterval( | ||
() => { | ||
if (!cleaningUp) { | ||
window.clearInterval(timer) | ||
resolve() | ||
} | ||
}, | ||
1 | ||
) | ||
} | ||
} | ||
else { | ||
const timer = setInterval(() => { | ||
if (!cleaningUp) { | ||
clearInterval(timer) | ||
resolve() | ||
} | ||
}, 1) | ||
} | ||
}) | ||
@@ -88,0 +106,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
656563
90
9830