function sendRequest (request, data) {
    return new Promise((resolve, reject) => {
        request.addEventListener('load', resolve);
        request.addEventListener('error', reject);
        request.addEventListener('abort', reject);
        request.send(data);
    });
}
/**
 * Send a previously defined XMLHttpRequest and return a promise.
 * @param {XMLHttpRequest} request A previously defined XMLHttpRequest
 * @param {Object} [data] String data to send with the request
 * @returns {Promise} Promise is resolved or rejected as the request finishes
 */
Send a previously defined XMLHttpRequest and return a promise.
@param {XMLHttpRequest} request A previously defined XMLHttpRequest
@param {Object} [data] String data to send with the request
@returns {Promise} Promise is resolved or rejected as the request finishes
Send a previously defined XMLHttpRequest and return a promise . @param { XMLHttpRequest } request A previously defined XMLHttpRequest @param { Object } [ data ] String data to send with the request @returns { Promise } Promise is resolved or rejected as the request finishes
function sendRequest (request, data) {
    return new Promise((resolve, reject) => {
        request.addEventListener('load', resolve);
        request.addEventListener('error', reject);
        request.addEventListener('abort', reject);
        request.send(data);
    });
}
function sendRequest ( request , data ) { return new Promise ( ( resolve , reject ) => { request . addEventListener ( 'load' , resolve ) ; request . addEventListener ( 'error' , reject ) ; request . addEventListener ( 'abort' , reject ) ; request . send ( data ) ; } ) ; }
Send a previously defined XMLHttpRequest and return a promise.
Send a previously defined XMLHttpRequest and return a promise .