Skip to content

Commit eee7e14

Browse files
author
Ari
committed
Updated default google maps version to 3.31
1 parent 16c1433 commit eee7e14

File tree

1 file changed

+49
-46
lines changed

1 file changed

+49
-46
lines changed

src/lib/GoogleApi.js

Lines changed: 49 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,51 @@
1-
import invariant from 'invariant'
1+
import invariant from 'invariant';
22

33
export const GoogleApi = function(opts) {
4-
opts = opts || {}
5-
6-
invariant(opts.hasOwnProperty('apiKey'),
7-
'You must pass an apiKey to use GoogleApi');
8-
9-
const apiKey = opts.apiKey;
10-
const libraries = opts.libraries || ['places'];
11-
const client = opts.client;
12-
const URL = opts.url || 'https://maps.googleapis.com/maps/api/js';
13-
14-
const googleVersion = opts.version || '3';
15-
16-
let script = null;
17-
let google = window.google || null;
18-
let loading = false;
19-
let channel = null;
20-
let language = opts.language;
21-
let region = null;
22-
23-
let onLoadEvents = [];
24-
25-
const url = () => {
26-
let url = URL;
27-
let params = {
28-
key: apiKey,
29-
callback: 'CALLBACK_NAME',
30-
libraries: libraries.join(','),
31-
client: client,
32-
v: googleVersion,
33-
channel: channel,
34-
language: language,
35-
region: region
36-
}
37-
38-
let paramStr = Object.keys(params)
39-
.filter(k => !!params[k])
40-
.map(k => `${k}=${params[k]}`).join('&');
41-
42-
return `${url}?${paramStr}`;
43-
}
44-
45-
return url();
46-
}
47-
48-
export default GoogleApi
4+
opts = opts || {};
5+
6+
invariant(
7+
opts.hasOwnProperty('apiKey'),
8+
'You must pass an apiKey to use GoogleApi'
9+
);
10+
11+
const apiKey = opts.apiKey;
12+
const libraries = opts.libraries || ['places'];
13+
const client = opts.client;
14+
const URL = opts.url || 'https://maps.googleapis.com/maps/api/js';
15+
16+
const googleVersion = opts.version || '3.31';
17+
18+
let script = null;
19+
let google = window.google || null;
20+
let loading = false;
21+
let channel = null;
22+
let language = opts.language;
23+
let region = null;
24+
25+
let onLoadEvents = [];
26+
27+
const url = () => {
28+
let url = URL;
29+
let params = {
30+
key: apiKey,
31+
callback: 'CALLBACK_NAME',
32+
libraries: libraries.join(','),
33+
client: client,
34+
v: googleVersion,
35+
channel: channel,
36+
language: language,
37+
region: region
38+
};
39+
40+
let paramStr = Object.keys(params)
41+
.filter(k => !!params[k])
42+
.map(k => `${k}=${params[k]}`)
43+
.join('&');
44+
45+
return `${url}?${paramStr}`;
46+
};
47+
48+
return url();
49+
};
50+
51+
export default GoogleApi;

0 commit comments

Comments
 (0)