English
Widget Sandbox
Blank map
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* Widget configuration.
*
* Every option below is optional except `target` and `type`. Add or remove
* freely — the preview reloads when you press Run.
*/
window.onemapWidget = {
widgetParts: [
{
target: 'onemap-widget', // element id, no '#'
type: 'map', // 'map' or 'test'
apiUrl: 'http://127.0.0.1:52949',
// A widget token ties requests to an account. Without one the widget
// runs signed-out, which limits it to public data.
token: null,
locale: 'en', // en, af, fr, nl, ns, st, tn, xh, zu
devMode: false, // shows the widget's own settings panel
mainColor: '6, 32, 67', // RGB triple, not hex
showLogo: true,
showFooter: true,
listeners: {
/**
* Called once the map is ready. `api` is the widget API — the same
* object your integration script receives.
*/
onReady: function (api) {
console.log('Widget ready. API keys:', Object.keys(api).join(', '))
window.__widgetApi = api
},
/** Fires whenever the visitor clicks the map. */
onMapClickCoords: function (lonLat) {
console.log('Clicked:', lonLat)
}
}
}
]
}
Preview
