3 function fetch_url(url
) {
4 return new Promise(function(resolve
, reject
) {
5 var request
= new XMLHttpRequest();
6 request
.addEventListener('load', function(event
) {
7 if (request
.status
== 200)
8 resolve(request
.response
);
10 reject(Error(request
.statusText
));
12 request
.open('GET', url
);