Toggle navigation
Toggle navigation
This project
Loading...
Sign in
arcs
/
arcs.js
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
3
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Jean-Yves Didier
2019-12-10 09:04:52 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
aa327533c9d0ab4cb490cc2046daeeb4cf2aebea
aa327533
1 parent
c9d251a9
context simplification with fetch API
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
19 deletions
src/context.js
src/context.js
View file @
aa32753
...
...
@@ -53,25 +53,8 @@ ARCS.Context = function( ctx ) {
}
});
}
else
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
var
client
=
new
XMLHttpRequest
();
client
.
open
(
'GET'
,
fileName
,
true
);
client
.
overrideMimeType
(
"application/json"
);
client
.
send
();
client
.
onload
=
function
()
{
if
(
this
.
status
>=
200
&&
this
.
status
<
300
)
{
resolve
(
JSON
.
parse
(
this
.
responseText
));
}
else
{
console
.
error
(
this
.
statusText
);
reject
(
this
.
statusText
);
}
};
client
.
onerror
=
function
()
{
console
.
error
(
this
.
statusText
);
reject
(
this
.
statusText
);
};
});
var
client
=
await
fetch
(
fileName
);
return
client
.
json
();
}
};
...
...
Please
register
or
login
to post a comment