Completed
Push — BaseComponent-BlockCookieNotif... ( 4a8b09...828b6e )
by
unknown
07:23 queued 05:07
created

Features/ExternalScriptLoader/Providers/googleMaps.js   A

Complexity

Total Complexity 4
Complexity/F 1.33

Size

Lines of Code 18
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 0
nc 1
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 4
mnd 1
bc 4
fnc 3
bpm 1.3333
cpm 1.3333
noi 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A googleMaps.js ➔ init 0 14 2
1
import $ from 'jquery'
2
3
let status
4
5
export function init (options) {
6
  if (!status) {
7
    const apiKey = options.apiKey
8
    const callback = `googleMaps_${Date.now()}`
9
    const url = `https://maps.googleapis.com/maps/api/js?key=${apiKey}&callback=${callback}`
10
    status = new Promise((resolve, reject) => {
0 ignored issues
show
Unused Code introduced by
The parameter reject is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
11
      window[callback] = () => {
12
        resolve()
13
      }
14
    })
15
    $.getScript(url)
16
  }
17
  return status
18
}
19