(dataAPI: any, params = {}, otherProps = {})
| 174 | * @returns |
| 175 | */ |
| 176 | export function jsonp(dataAPI: any, params = {}, otherProps = {}) { |
| 177 | return new Promise((resolve, reject) => { |
| 178 | const processedOtherProps = { |
| 179 | timeout: 5000, |
| 180 | ...otherProps, |
| 181 | }; |
| 182 | const url = buildUrl(dataAPI, params); |
| 183 | fetchJsonp(url, processedOtherProps) |
| 184 | .then((response) => { |
| 185 | response.json(); |
| 186 | }) |
| 187 | .then((json) => { |
| 188 | if (json) { |
| 189 | resolve(json); |
| 190 | } else { |
| 191 | reject(); |
| 192 | } |
| 193 | }) |
| 194 | .catch((err) => { |
| 195 | reject(err); |
| 196 | }); |
| 197 | }); |
| 198 | } |
no test coverage detected
searching dependent graphs…