Kick jsonp - fixes #2682

This commit is contained in:
Stephan Hoyer 2022-05-31 09:54:41 +02:00
parent efdb563fa5
commit 716d1e1804
16 changed files with 8 additions and 362 deletions

View file

@ -1379,24 +1379,6 @@ var _17 = function($window, oncompletion) {
else if (body instanceof $window.FormData || body instanceof $window.URLSearchParams) xhr.send(body)
else xhr.send(JSON.stringify(body))
}),
jsonp: makeRequest(function(url, args, resolve, reject) {
var callbackName = args.callbackName || "_mithril_" + Math.round(Math.random() * 1e16) + "_" + callbackCount++
var script = $window.document.createElement("script")
$window[callbackName] = function(data) {
delete $window[callbackName]
script.parentNode.removeChild(script)
resolve(data)
}
script.onerror = function() {
delete $window[callbackName]
script.parentNode.removeChild(script)
reject(new Error("JSONP request failed"))
}
script.src = url + (url.indexOf("?") < 0 ? "?" : "&") +
encodeURIComponent(args.callbackKey || "callback") + "=" +
encodeURIComponent(callbackName)
$window.document.documentElement.appendChild(script)
}),
}
}
var request = _17(typeof window !== "undefined" ? window : null, mountRedraw0.redraw)
@ -1799,7 +1781,6 @@ m.route = _26(typeof window !== "undefined" ? window : null, mountRedraw)
m.render = render
m.redraw = mountRedraw.redraw
m.request = request.request
m.jsonp = request.jsonp
m.parseQueryString = parseQueryString
m.buildQueryString = buildQueryString
m.parsePathname = parsePathname