Merge branch 'rewrite' into array-isArray

This commit is contained in:
Barney Carroll 2017-01-04 14:24:07 +00:00
commit fbb454c6fd
45 changed files with 1132 additions and 449 deletions

View file

@ -63,6 +63,10 @@ module.exports = function($window, Promise) {
}
if (args.withCredentials) xhr.withCredentials = args.withCredentials
for (var key in args.headers) if ({}.hasOwnProperty.call(args.headers, key)) {
xhr.setRequestHeader(key, args.headers[key])
}
if (typeof args.config === "function") xhr = args.config(xhr, args) || xhr
xhr.onreadystatechange = function() {
@ -93,7 +97,7 @@ module.exports = function($window, Promise) {
function jsonp(args, extra) {
var finalize = finalizer()
args = normalize(args, extra)
var promise = new Promise(function(resolve, reject) {
var callbackName = args.callbackName || "_mithril_" + Math.round(Math.random() * 1e16) + "_" + callbackCount++
var script = $window.document.createElement("script")