mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-13 20:39:57 +01:00
Add extra header support to Tomahawk.asyncRequest
This commit is contained in:
parent
74c2d0e776
commit
251200d9cd
@ -184,10 +184,15 @@ Tomahawk.syncRequest = function(url)
|
||||
}
|
||||
};
|
||||
|
||||
Tomahawk.asyncRequest = function(url, callback)
|
||||
Tomahawk.asyncRequest = function(url, callback, extraHeaders)
|
||||
{
|
||||
var xmlHttpRequest = new XMLHttpRequest();
|
||||
xmlHttpRequest.open('GET', url, true);
|
||||
if (extraHeaders) {
|
||||
for(var headerName in extraHeaders) {
|
||||
xmlHttpRequest.setRequestHeader(headerName, extraHeaders[headerName]);
|
||||
}
|
||||
}
|
||||
xmlHttpRequest.onreadystatechange = function() {
|
||||
if (xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 200) {
|
||||
callback.call(window, xmlHttpRequest);
|
||||
|
Loading…
x
Reference in New Issue
Block a user