Kick jsonp - fixes #2682
This commit is contained in:
parent
efdb563fa5
commit
716d1e1804
16 changed files with 8 additions and 362 deletions
19
mithril.js
19
mithril.js
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue