-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.js
30 lines (30 loc) · 896 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function getTestRom(filename, callback) {
$.ajax({
url: escape(filename),
xhr: function() {
var xhr = $.ajaxSettings.xhr();
if (typeof xhr.overrideMimeType !== 'undefined') {
// Download as binary
xhr.overrideMimeType('text/plain; charset=x-user-defined');
}
self.xhr = xhr;
return xhr;
},
complete: function(xhr, status) {
var i, data;
if (JSNES.Utils.isIE()) {
var charCodes = JSNESBinaryToArray(
xhr.responseBody
).toArray();
data = String.fromCharCode.apply(
undefined,
charCodes
);
}
else {
data = xhr.responseText;
}
callback(data);
}
});
}