Skip to content

Commit

Permalink
Merge branch 'hotfix/1.5.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamDASILVA committed Mar 27, 2018
2 parents f5052d0 + 986bebc commit 03dcd9e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dist/module.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuxt-google-maps-module",
"version": "1.5.3",
"version": "1.5.4",
"description": "NuxtJS module to import Google Maps",
"license": "MIT",
"contributors": [
Expand Down
1 change: 0 additions & 1 deletion src/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ module.exports = function module(moduleOptions) {
*/
this.addPlugin({
src: resolve(__dirname, './plugin.template.js'),
ssr: false,
options,
});
};
Expand Down
14 changes: 11 additions & 3 deletions src/plugin.template.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import Vue from 'vue';

export default function (context) {
export default function (context, inject) {
/**
* Inject Google object in our Vue app (client side only)
* Inject the Google object in the Nuxt instance, even if it's
* not used server side.
*/
context.app.google = {};
inject('google', {});

/**
* Apply the new Google object to the previously created one in our
* Vue app (client side only)
* Do an event boomerang to make sure the Google maps API callback was
* called and google injected in Vue.
*/
if (typeof window !== 'undefined') {
if (process.client && typeof window !== 'undefined') {
const event = new window.Event('maps-module:initiated');
window.dispatchEvent(event);
window.addEventListener('maps-module:loaded', () => {
Expand Down

0 comments on commit 03dcd9e

Please sign in to comment.