react-google-places-autocomplete
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -12,2 +12,3 @@ 'use strict'; | ||
var injectScript = function injectScript(apiKey) { | ||
if (document.getElementById(SCRIPT_ID)) return; | ||
var script = document.createElement('script'); | ||
@@ -14,0 +15,0 @@ script.id = SCRIPT_ID; |
@@ -12,5 +12,7 @@ "use strict"; | ||
var React = _interopDefault(require("react")), PropTypes = _interopDefault(require("prop-types")), SCRIPT_ID = "react-google-places-autocomplete", injectScript = function(apiKey) { | ||
var script = document.createElement("script"); | ||
script.id = SCRIPT_ID, script.type = "text/javascript", script.src = "https://maps.googleapis.com/maps/api/js?key=" + apiKey + "&libraries=places", | ||
document.body.appendChild(script); | ||
if (!document.getElementById(SCRIPT_ID)) { | ||
var script = document.createElement("script"); | ||
script.id = SCRIPT_ID, script.type = "text/javascript", script.src = "https://maps.googleapis.com/maps/api/js?key=" + apiKey + "&libraries=places", | ||
document.body.appendChild(script); | ||
} | ||
}, removeScript = function() { | ||
@@ -17,0 +19,0 @@ var script = document.getElementById(SCRIPT_ID); |
@@ -6,2 +6,3 @@ import React from 'react'; | ||
var injectScript = function injectScript(apiKey) { | ||
if (document.getElementById(SCRIPT_ID)) return; | ||
var script = document.createElement('script'); | ||
@@ -8,0 +9,0 @@ script.id = SCRIPT_ID; |
{ | ||
"name": "react-google-places-autocomplete", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "Google places autocomplete input for ReactJS.", | ||
@@ -5,0 +5,0 @@ "main": "dist/react-google-places-autocomplete.cjs.js", |
const SCRIPT_ID = 'react-google-places-autocomplete'; | ||
export const injectScript = (apiKey) => { | ||
if (document.getElementById(SCRIPT_ID)) return; | ||
const script = document.createElement('script'); | ||
@@ -5,0 +7,0 @@ |
278028
1862