summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/extensions/blocks/map/view.js')
-rw-r--r--plugins/jetpack/extensions/blocks/map/view.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/plugins/jetpack/extensions/blocks/map/view.js b/plugins/jetpack/extensions/blocks/map/view.js
new file mode 100644
index 00000000..fc825d67
--- /dev/null
+++ b/plugins/jetpack/extensions/blocks/map/view.js
@@ -0,0 +1,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,
+ },
+ },
+ },
+ },
+ ] );
+ } );