| Conditions | 4 |
| Paths | 0 |
| Total Lines | 43 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | |||
| 12 | export function jassl(src, async = false) { |
||
| 13 | |||
| 14 | if (!Promise || !Promise.all) |
||
| 15 | { |
||
| 16 | throw new Error('Promises are not available your environment.'); |
||
| 17 | } |
||
| 18 | |||
| 19 | if (!src) |
||
| 20 | { |
||
| 21 | throw new Error('src should not be empty.'); |
||
| 22 | } |
||
| 23 | |||
| 24 | return new Promise((resolve, reject) => { |
||
| 25 | |||
| 26 | const element = window.document.createElement('script'); |
||
| 27 | |||
| 28 | element.onload = () => { |
||
| 29 | resolve(src); |
||
| 30 | }; |
||
| 31 | |||
| 32 | element.onerror = () => { |
||
| 33 | reject(new Error(src)); |
||
| 34 | }; |
||
| 35 | |||
| 36 | element.async = true === async; |
||
| 37 | element.src = src; |
||
| 38 | |||
| 39 | window.document.body.appendChild(element); |
||
| 40 | })/* .then((s) => { |
||
| 41 | |||
| 42 | const found = s && rainloopCaches ? s.match(/rainloop\/v\/([^\/]+)\/static\//) : null; |
||
| 43 | if (found && found[1]) |
||
| 44 | { |
||
| 45 | rainloopCaches.open('rainloop-offline-' + found[1]).then( |
||
| 46 | (cache) => cache.add(s) |
||
| 47 | ).catch(() => { |
||
| 48 | rainloopCaches = null; |
||
| 49 | }); |
||
| 50 | } |
||
| 51 | |||
| 52 | return s; |
||
| 53 | })*/; |
||
| 54 | } |
||
| 55 |
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.