-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGoogleMaps.js
More file actions
25 lines (21 loc) · 887 Bytes
/
GoogleMaps.js
File metadata and controls
25 lines (21 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import GoogleMapsPluginApi from "./reusable/GoogleMapsPluginApi.js"
import { PLUGINS_APIKEY } from "./reusable/apikey.js"
const plugin = ({widgets, simulator}) => {
let boxGlobal = null
widgets.register("Directions", (box) => {
boxGlobal = box
box.injectHTML("<div style='display: flex; height: 100%; width: 100%; justify-content: center; align-items: center; text-align: center; font-family: sans-serif; color: #6b7280; user-select: none;'>Pass lat/lng from prototype code, and run to create map.</div>")
return () => {
boxGlobal = null
// Deactivation function for clearing intervals or such.
}
})
return {
createDirections: (path) => {
if (boxGlobal !== null) {
GoogleMapsPluginApi(PLUGINS_APIKEY, boxGlobal, path)
}
}
}
}
export default plugin