function getJSON(url, callback) {
let xhr = new XMLHttpRequest();
xhr.onload = function () {
callback(this.responseText)
xhr.open('GET', url, true);
export function getUsefulContents(url, callback) {
getJSON(url, data => callback(JSON.parse(data)));
import { getUsefulContents } from 'file';
getUsefulContents('http://www.example.com', data => {