UNPKG

@dotsoftware/vue-google-maps-community-fork

Version:

Google Maps components for VueJS 3 maintained by the community

32 lines (29 loc) 863 B
/** * @class MapElementMixin * * Extends components to include the following fields: * * @property $map The Google map (valid only after the promise returns) * * * */ export default { inject: { $mapPromise: { default: 'abcdef' }, }, provide() { // Note: although this mixin is not "providing" anything, // components' expect the `$map` property to be present on the component. // In order for that to happen, this mixin must intercept the $mapPromise // .then(() =>) first before its component does so. // // Since a provide() on a mixin is executed before a provide() on the // component, putting this code in provide() ensures that the $map is // already set by the time the // component's provide() is called. this.$mapPromise.then((map) => { this.$map = map }) return {} }, }