| 267 | } |
| 268 | |
| 269 | function jsonp (url, callback) { |
| 270 | const callbackName = 'jsonp_callback_' + Math.round(1000000000 * Math.random()) |
| 271 | window[callbackName] = function (data) { |
| 272 | delete window[callbackName] |
| 273 | document.body.removeChild(script) |
| 274 | callback(data) |
| 275 | } |
| 276 | |
| 277 | const script = document.createElement('script') |
| 278 | script.src = url + (url.indexOf('?') >= 0 ? '&' : '?') + 'callback=' + callbackName |
| 279 | document.body.appendChild(script) |
| 280 | script.onerror = function (e) { |
| 281 | console.error(e) |
| 282 | script.remove() |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | // dynamic event or object binding here |
| 287 | export function finishView (view) { |