@tabnine/jupyterlab
Version:
JupyterLab client for Tabnine
17 lines (16 loc) • 438 B
text/typescript
export function getJSON(url: string): Promise<Record<string, any>> {
return new Promise<Record<string, any>>((resolve, reject) => {
var xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.responseType = "json";
xhr.onload = function () {
var status = xhr.status;
if (status === 200) {
resolve(xhr.response);
} else {
reject(xhr.response);
}
};
xhr.send();
});
}