Primo committ Notevole

This commit is contained in:
Paolo Arena
2019-12-28 11:16:53 +01:00
commit 5d32378df8
174 changed files with 29861 additions and 0 deletions

25
src/googlemap/index.ts Normal file
View File

@@ -0,0 +1,25 @@
let promise = null
const id = 'google-cdn'
const url = 'https://maps.googleapis.com/maps/api/js?key=AIzaSyB228FQfRMabWfIczMamI1NSYMJg2FqLts'
export default () => {
if (!promise) {
promise = new Promise((resolve, reject) => {
if (document.getElementById(id)) {
console.error(`Error loading ${url} async: ${id} is not unique`)
return
}
const script = document.createElement('script')
script.src = url
script.async = true
script.id = id
script.onload = () => {
resolve()
}
script.onerror = (err) => {
reject(err)
}
document.body.appendChild(script)
})
}
return promise
}