summaryrefslogtreecommitdiff
blob: fc825d6704185ec7fd84e851e5267381e8b233ad (plain)
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
/**
 * Internal dependencies
 */
import './style.scss';
import component from './component.js';
import { settings } from './settings.js';
import FrontendManagement from '../../shared/frontend-management.js';

typeof window !== 'undefined' &&
	window.addEventListener( 'load', function() {
		const frontendManagement = new FrontendManagement();
		// Add apiKey to attibutes so FrontendManagement knows about it.
		// It is dynamically being added on the php side.
		// So that it can be updated accross all the map blocks at the same time.
		const apiKey = {
			type: 'string',
			default: '',
		};
		frontendManagement.blockIterator( document, [
			{
				component: component,
				options: {
					settings: {
						...settings,
						attributes: {
							...settings.attributes,
							apiKey,
						},
					},
				},
			},
		] );
	} );